[twitter] How to get user's high resolution profile picture on Twitter?

I was reading the Twitter documentation at https://dev.twitter.com/overview/general/user-profile-images-and-banners and it clearly states that:

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. 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.

Twitter API's response is like this for my own account:

{
  ....
  "profile_image_url_https" = "https://pbs.twimg.com/profile_images/559415382457348097/qSYxxIAo_normal.png";
  ...
}

That image URL works, but it's too small. I need the highest resolution available. I do exactly what Twitter says, and omit the _normal suffix, and try this URL:

https://pbs.twimg.com/profile_images/559415382457348097/qSYxxIAo.png

But it's not found. Is Twitter docs outdated or am I missing a point?

UPDATE: I've tried with a few friends' profiles and most of them seem to work, and removing any suffixes and adding _400x400.[jpg|png] also seems to work, but it's undocumented and unreliable, so I really doubt that I should be using this undocumented API in production.

UPDATE 2: I've refreshed my user object as Twitter also states in case of outdated images, but nothing has changed.

This question is related to twitter

The answer is


for me the "workaround" solution was to remove the "_normal" from the end of the string

Check it out below:


use this URL : "https://twitter.com/(userName)/profile_image?size=original"

If you are using TWitter SDK you can get the user name when logged in, with TWTRAPIClient, using TWTRAuthSession.

This is the code snipe for iOS:

if let twitterId = session.userID{
   let twitterClient = TWTRAPIClient(userID: twitterId)
   twitterClient.loadUser(withID: twitterId) {(user, error) in
       if let userName = user?.screenName{
          let url = "https://twitter.com/\(userName)/profile_image?size=original")
       }
   }
}