28

http://www.theverge.com/2015/7/6/8899807/instagram-1080p-pictures-photo-upload

The Verge recently made known the latest app versions of Instagram are uploading photos in 1080x1080 resolution. These photos can be easily sourced via HTML when browsing the site's source code. Can these be accessed via the official Instagram API? And if so, how?

Adam Black
  • 327
  • 1
  • 3
  • 3

10 Answers10

23

[Update] After Mar 23, 2018

I used Ekrem Gurdal's answer to make it work:

The IG API gives you "link" attribute, e.g. https://www.instagram.com/p/BTduOwSAwN6/

Then you can append ?__a=1 to this e.g. https://www.instagram.com/p/BTduOwSAwN6/?__a=1

And you can extract from the json result where the high resolution photo is stored: graphsql.shortcode_media.display_url

E.g. https://instagram.fmnl2-1.fna.fbcdn.net/vp/f8f54b9fcb2bca69d7c73d9ffb232d64/5C324A1C/t51.2885-15/e35/18161146_397673830625587_2385146908864675840_n.jpg

Hope this helps. Maybe IG folks will also find a way to disable this in the future. Why do they not just include the hi-res photo in the API response, smh

[Update] As of Mar 23, 2018, workaround below doesn't work anymore.

Just to update anyone who's looking at this in 2018. The solution that worked for me is to remove the "vp/" on top of replacing the resolution to 1080x1080.

E.g.

https://scontent.cdninstagram.com/vp/41d5aee08758061976d26e48f45e673a/5ADA338E/t51.2885-15/s320x320/e35/20065394_1785212551507111_5192354829363576832_n.jpg

to

https://scontent.cdninstagram.com/41d5aee08758061976d26e48f45e673a/5ADA338E/t51.2885-15/s1080x1080/e35/20065394_1785212551507111_5192354829363576832_n.jpg
Manny
  • 6,277
  • 3
  • 31
  • 45
15

Not sure why you are getting down-voted, but no, that resolution is not returned by the API at the moment. However, it can be "guessed" from the other resolutions returned by the API, but that could change at any time. For example, given the standard resolution JSON:

  "standard_resolution": {
    "url": "https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s640x640/e35/sh0.08/11370971_837216559694773_771634899_n.jpg",
    "width": 640,
    "height": 640
  }

Remove the size part (s640x640 here) and the two paths that follows (e35/sh0.08 for this picture, likely different for yours) to end up with the URL to the 1080x1080:

    https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/11370971_837216559694773_771634899_n.jpg

This has worked since that resolution was activated on my account. But again, I would just wait for the API.

sebastien.b
  • 1,049
  • 1
  • 14
  • 12
9

As of 26th March 2018, Instagram changed their links. Here's a working solution to get 1080x1080 resolution images from API.

  1. Get the user_Id from https://www.instagram.com/{username}/?__a=1.

  2. Paste the user_id in this link https://i.instagram.com/api/v1/users/{user_id}/info/.

  3. Get the hd url link from hd_profile_pic_url_info. :)

  • Are you using IG API? because I can't find and HQ links in their API response. – user1945821 Mar 26 '18 at 11:59
  • @user1945821 - Just copy the user_id from the first link and paste that in the second link. In the api response from the second link you can get all the links related to profile picture. – Ganesh Munisifreddy Mar 26 '18 at 12:04
  • Haa ok, I was looking for user's media (pictures) not profile picture. And they return only thumbnail, low_resolution, standard_resolution. no hd or any high resolution – user1945821 Mar 26 '18 at 12:12
  • 1
    The 2nd link is broken, it redirects to the login page of Instagram instead of returning JSON. Why? – Martin Braun Jan 21 '19 at 13:33
  • Upvoted. As of 27th March 2019 this is the only solution that worked for me. All the others give me either "access denied" or "URL structure mismatch". – Will Appleby Mar 27 '19 at 22:21
4

I noticed that simply removing the size part, the biggest image is returned:

https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s640x640/e35/sh0.08/11370971_837216559694773_771634899_n.jpg

to

https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/e35/sh0.08/11370971_837216559694773_771634899_n.jpg

Hence this should do the trick:

var hightUrl = data.images.standard_resolution.url.replace("/s640x640/","/");
alessandrio
  • 4,282
  • 2
  • 29
  • 40
Omiod
  • 11,285
  • 11
  • 53
  • 59
4

You can simply fetch 1080p image if available by using this url:

https://www.instagram.com/p/['IMAGE-CODE']/?__a=1

Different size of an image

Ekrem Gurdal
  • 1,118
  • 13
  • 14
4

The problem with instagram image URL's is that the URL signatures provided in the json responses expire after some time. My workaround for this problem is as follows:

Steps: 1. Get the instagram post link. Eg : https://www.instagram.com/p/Bo-Jru-g7Wa/

or if you don't have the link, the instagram api provides you with a permalink(image-code) option in the result array which for the above link is Bo-Jru-g7Wa

  1. Now just add media?size=l after the url ie.,

Result: High quality image url:

https://www.instagram.com/p/Bo-Jru-g7Wa/media?size=l

you can see it in action here: https://jsfiddle.net/nmj1z7wo/fiddle URL

This link can be considered as a shorthand code to instagram image URL's which are very much bigger. Supported values for size are t (thumbnail), m (medium), l (large). Defaults to m.

Nitin Tokas
  • 182
  • 11
  • `media?size=l` will be the 1080 version max even if bigger versions exist. – user136036 Mar 03 '21 at 00:04
  • Yes and I think that should be sufficient for most of the use-cases. also you don't have to recreate the image urls every some hours(fb recreates hex codes every 24 to 72 hrs) if you use the above solution. – Nitin Tokas Mar 03 '21 at 22:43
  • any way of fetching higher quality pictures than 1080? I tried putting media?size=xl - it didn't work – DarkestOne Apr 22 '22 at 01:55
  • @DarkestOne the max available is 1080 version as instagram compresses the images internally after you upload them. So max you can get is size=l – Nitin Tokas Apr 28 '22 at 15:06
  • I can regularly find 1440x1800 version of picture on many profiles. For instance on https://www.instagram.com/p/CcwARWxv2jS - developer tools under src attribute there is 1440x1800 version of picture – DarkestOne Apr 30 '22 at 03:07
  • @DarkestOne you will see a cache key attached there. The key used to expires daily(I currently don't know the time to expire but it will expire in some time). After the key expires you can't see the image as the link won't show you the image. My answer to this question is only option I was able to find to retrieve the image every time. – Nitin Tokas Jun 02 '22 at 21:56
1

This works as of 20th March 2018.

Remove the vp and the size parts. So if we have a 150x150 image here

https://scontent.cdninstagram.com/vp/6f28b299faab04675a936073c94d0fde/5B2E3498/t51.2885-15/s150x150/e35/c135.0.810.810/28152308_875888592619569_7505395194448052224_n.jpg

Remove /vp and /s150x150 to get

https://scontent.cdninstagram.com/6f28b299faab04675a936073c94d0fde/5B2E3498/t51.2885-15/e35/c135.0.810.810/28152308_875888592619569_7505395194448052224_n.jpg

And we can get the 1080 image here

You can even just leave the last two segments

https://scontent.cdninstagram.com/e35/28152308_875888592619569_7505395194448052224_n.jpg

which can be seen here

Hope this helps

SpeedOfSpin
  • 1,611
  • 20
  • 21
1

This worked for me today (15 August 2018) for most public images. I think, because people use different apps to upload images, the API may show different sizes but the links are to the same default resolution file.

  1. Go to the user's page: https://www.instagram.com/username
  2. Click on the image you want and the URL bar will change to: https://www.instagram.com/p/image-code/?taken-by=username
  3. Copy the image-code from the URL
  4. Go to: https://www.instagram.com/p/image-code/?__a=1
  5. Scan through the JSON file (it helps to have a JSON viewer extension enabled) and click on the highest resolution image to download it. For example:

enter image description here

ow3n
  • 5,974
  • 4
  • 53
  • 51
  • Is it still working. i want to get hd_profile_pic_url_info. Is it possible anyhow? – Awadesh Dec 31 '18 at 04:39
  • @Awadesh Yes, I used it just last week. – ow3n Dec 31 '18 at 09:47
  • Actually i want to get this data on server side for my android app. I have no platform where user will click on the image. Could you please suggest something – Awadesh Dec 31 '18 at 11:05
0

I'm unsure whether it's possible to get a 1080p resolution image. But here is one way to get an image with 320x320 resolution.

1) Enter the username of the user in the following URL. Here I'm using simonsterstrength as username. https://www.instagram.com/simonsterstrength/?__a=1

2) Search for "profile_pic_url_hd" and copy the URL and access the picture that IG calls it as HD.


Note: As of June-2020, the response from IG CDN is OK.

kmario23
  • 57,311
  • 13
  • 161
  • 150
-1

You received

"standard_resolution": {
    "url": "https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s640x640/e35/sh0.08/11370971_837216559694773_771634899_n.jpg",
    "width": 640,
    "height": 640
  }

It's possible to replace s640x640 with s1080x1080 or 2048x2048. Both this request return image with resolut 1080x1080

var hightUrl = data.images.standard_resolution.url.replace("s640x640","s1080x1080");
Dmitry
  • 477
  • 6
  • 20
  • 1
    Nice use of my own example code to write essentially the same answer :) – sebastien.b Sep 19 '15 at 03:29
  • 3
    It's not the same anwer... both return a different image. The one from the example of sebastien.b returns the real 1080 resolution picture, if availible. The answer of Dmitry returns an upscaled version of the 640x640 image. This one is bigger, almost 100KB and the quality is clearly less then the original 1080 one. – Wesley Lalieu Dec 20 '15 at 13:41