Will Instagram provide any way to grab the portrait/landscape through the API ? API docs looks untouched.
As of now, they still returns the square sizes for the portrait images, but the api documentation doesn't provide any way to get the original image.
Will they keep returning the square images? Do Instagram have any comments about this?
As of Sept. 3rd 2015, instagram now allows API clients to get the images in their original aspect ratio (i.e. rectangular for Landscapes, Portraits) and will not crop them, if you updated a new setting in the API Client.
That's it! Now when you get the images from the API endpoints, the portraits, landscapes that were uploaded will not be cropped to square images, and the originals will be returned.
Related Blog Post: API migration for landscape and portrait formats
Yes, the API looks untouched, but I found a hack to get to the original images for Landscapes and Portraits. You have to programatically remove a section of the urls returned in the images
array.
See below -- snippet from my answer here.
The API is still returning the square versions for images, even the ones that are uploaded as Portraits or Landscapes. If you want the original landscape / portrait images also, you have to do a little hack -- details below -- until they address it in their API response.
See this one photo of Taylor Swift uploaded by 1 of the user's mentioned in IG's blog post / press release -- @johnbenett
https://instagram.com/p/6ZVIHTJLYg/
This is the original uploaded photo - Portrait 512 px x 640 px
And here's what the Instagram API returns, for the various images (including thumbnail) for the above portrait image.
"images": {
"low_resolution": {
"url": "https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s320x320/e35/c0.135.1080.1080/11909195_1715998838621946_791786043_n.jpg",
"width": 320,
"height": 320
},
"thumbnail": {
"url": "https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s150x150/e35/c0.135.1080.1080/11909195_1715998838621946_791786043_n.jpg",
"width": 150,
"height": 150
},
"standard_resolution": {
"url": "https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s640x640/sh0.08/e35/c0.135.1080.1080/11909195_1715998838621946_791786043_n.jpg",
"width": 640,
"height": 640
}
So the standard resolution image returned by the API for this Portrait image is 640 px square and looks like this.
and the low resolution image returned by the API for this Portrait image is 320 px square and looks like this.
and last but not least, the thumbnail image returned by the API for this Portrait image is 150 px square and looks like this.
Since the API returns only 1 set of images as of now, but the site is able to show the original aspect ratio images, I did some digging around, and realized that if you remove the last but 1 section of the url from the square image urls (in this example, remove /c0.135.1080.1080
) you get to the original aspect ratio sized (and uncropped) landscape, portrait images.
Keeping the same example above:
Standard Resolution Portrait Image ( 512 px x 640 px ) URL:
https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s640x640/sh0.08/e35/11909195_1715998838621946_791786043_n.jpg
and it looks like this.
Low Resolution Portrait Image ( 256 px x 320 px ) URL:
https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s320x320/e35/11909195_1715998838621946_791786043_n.jpg
and it looks like this.
Thumbnail Portrait Image ( 120 px x 150 px ) URL:
https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s150x150/e35/11909195_1715998838621946_791786043_n.jpg
and it looks like this.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With