Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

instagram api return not square photos with white lines

I posted not square photo in instagram https://instagram.com/p/7M7aBoNTcM/

By instagram api using https_//api.instagram.com/v1/media/1061415553965831926_2141618404?access_token=Token tried to get all photos and I have for that image the next standard_resolution url: https://scontent.cdninstagram.com/hphotos-xfa1//t51.2885-15//s640x640//sh0.08//e35//11821940_708988202567623_81870409_n.jpg

There are not param for cropping, but I got my image with white lines at the top and at the bottom of image.

Why on the instagram's web site my image as I sent(rectangular), but api returns square with white lines?

How I can post not square pictures for getting them without white lines?

like image 902
Dmitry Avatar asked Sep 04 '15 08:09

Dmitry


People also ask

Why are my Instagram photos not square?

Once you've selected a photo (or video) from your phone library, you will now see a format icon button above the camera roll. 1. The new photo shapes are accessed by tapping the format icon in the lower left of the photo. You can use this button to toggle between square and full-size images.

Did Instagram go back to square photos?

Today, we're excited to announce that — in addition to square posts — you can now share photos and videos in both portrait and landscape orientation on Instagram. Square format has been and always will be part of who we are.

When did Instagram stop being square?

Hate cropping your pictures into a square format on Instagram? You're in luck! While the app did away with the mandatory square format in August 2015, the rule still stuck for users creating multiple photo and videos posts.


1 Answers

Sept. 4th 2015 Update:

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.

Steps:

  1. Login to into your client application settings on https://instagram.com/developer/
  2. Click Manage Clients on top nav menu.
  3. Locate your API Client, and click Edit.
  4. Click the Migrations Tab for your API Client application, and check the box that says "Non square media".
  5. Click Update Client.

enter image description here

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

Previous Answer (Deprecated. Don't read unless you want box square and landscape / portrait versions at the same time)

As far as I can tell, Instagram has not updated their API to return the original images in various sizes for the new Landscape / Portrait upload feature they rolled out recently.

There is a -- for lack of a better word - "workaround" that you can use to get the original uncropped landscape / portrait images from the square images returned by the api for your landscape / portrait photo.

Here's how.

Take the Thumbnail image URL returned by the API. In your case, the URL returned is https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e35/c257.0.565.565/11375403_666004300168456_93194657_n.jpg

enter image description here

If you remove the last url segment before the image name, i.e. /c257.0.565.565 you will get the url for the landscape thumbnail. (see below)

enter image description here

Here's how you get the other 2 sizes in their original aspect ratio.

Now using this new url that has the last url segment removed,

  • if you replace Thumbnail Returned by API (cropped / with white borders) s150x150 with s320x320 you will be the low resolution landscape image url and
  • if you replace Thumbnail Returned by API (cropped / with white borders) s150x150 with s640x640 you will get the standard resolution landscape image.

You can programatically do all this after getting the thumbnail url from the API.

Like I said before, this is a workaround until Instagram officially updates their API and exposes these additional images.

https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e35/c257.0.565.565/11375403_666004300168456_93194657_n.jpg

Thumbnail Landscape (uncropped)

https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e35/11375403_666004300168456_93194657_n.jpg

Thumbnail Landscape uncropped

Low Resolution Landscape (uncropped)

https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s320x320/e35/11375403_666004300168456_93194657_n.jpg [Low Resolution landscape uncropped2

Standard Resolution Landscape (uncropped)

https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s640x640/e35/11375403_666004300168456_93194657_n.jpg

Standard Resolution Landscape

like image 187
Shiva Avatar answered Jan 03 '23 12:01

Shiva