User Profile Images and Banners

Updated on Mon, 2014-04-21 19:15

Profile Images

Profile images (or avatars) are an important component of a Twitter account's expression of identity. To upload an avatar on behalf of a user, use POST account/update_profile_image.

Alternative image sizes for user profile images

You can obtain a user's most recent profile image, along with the other components comprising their identity on Twitter, from GET users/show. Within the user object, you'll find the profile_image_url and profile_image_url_https fields. Typically, these fields will contain the resized "normal" variant of the user's uploaded image. This "normal" variant is typically 48px by 48px.

By modifying the URL, you can retrieve other variant sizings such as "bigger", "mini", and "original". Consult the table below for more examples:

Variant Dimensions Example URL
normal 48px by 48px http://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_normal.png
https://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_normal.png
bigger 73px by 73px http://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_bigger.png
https://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_bigger.png
mini 24px by 24px http://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_mini.png
https://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_mini.png
original original http://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3.png
https://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3.png
Omit the underscore and variant to retrieve the original image. The images can be very large.

Default profile images

Some users may not have uploaded a profile image yet. At this time, these users are affectionally known as "eggs" due to Twitter's default avatar image depicting an egg on a colorful background. Users who have not uploaded a profile image can be identified by the default_profile_image field of their user object having a true value.

The profile_image_url and profile_image_url_https URLs provided for users in this case will indicate which "egg" the user has been assigned, such as http://a0.twimg.com/sticky/default_profile_images/default_profile_6_normal.png.

SSL-enabled profile images

The SSL-enabled path template for a profile image is indicated in the profile_image_url_https. The table above demonstrates how to apply the same variant selection techniques to SSL-based images.

Outdated profile images

If you are encountering a 403 or 404 error when trying to access a profile image, please refresh your user object using GET users/show to make sure you are using the most recent profile_image_url or profile_image_url_https. The URL may have changed, which happens for instance when the user updates their profile image.

Profile Banners

Profile Banners are a recent addition to Twitter letting users further customize the expressiveness of their profiles. Profile banners come in a variety of display-enhanced sizes. The variant sizes are available through a request to GET users/profile_banner or by munging the final path component of the profile_banner_url you may find in a user object.

The profile banner data available at each size variant's URL is in PNG format.

The following sizes are available:

LabelSizeExample
1500x5001500x500https://pbs.twimg.com/profile_banners/783214/1347405327/1500x500
600x200600x200https://pbs.twimg.com/profile_banners/783214/1347405327/600x200
300x100300x100https://pbs.twimg.com/profile_banners/783214/1347405327/300x100
web520x260https://pbs.twimg.com/profile_banners/6253282/1347394302/web
web_retina1040x520https://pbs.twimg.com/profile_banners/6253282/1347394302/web_retina
ipad626x313https://pbs.twimg.com/profile_banners/6253282/1347394302/ipad
ipad_retina1252x626https://pbs.twimg.com/profile_banners/6253282/1347394302/ipad_retina
mobile320x160https://pbs.twimg.com/profile_banners/6253282/1347394302/mobile
mobile_retina640x320https://pbs.twimg.com/profile_banners/6253282/1347394302/mobile_retina