Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting a High Resolution picture from Facebook API

Facebook FQL API for Photos states the maximum resolution for a photo returned from the API is 960x960:

The Photo object has an equivalent src connection. Using photo_src FQL, you can retrieve images with the following dimensions: 960, 720, 480, 320, 180, 130, 75 pixels.

However, some images are uploaded at a higher resolution. Sometimes even much higher.

When browsing Facebook regularly, you can see these pictures and view their full size. However, I can't seem to find any way to get the original resolution in the API.

Is this possible and I have missed something? And if it's not - why?

like image 978
jbkkd Avatar asked Dec 22 '12 22:12

jbkkd


People also ask

How do you get high resolution photos on Facebook?

To change that all that's needed is to go into the main FB mobile Menu > Settings > Account Settings > Videos and Photos, then toggle the two sliders over to the right. There's one slider for uploading video in HD and the other for uploading photos in HD.

Does Facebook send full resolution photos?

Conclusion: there is no way to send a full size image on Messenger in 2021. So unfortunately, as of 2021, there is no way to send photos in their original file size via Messenger and you would need to use a different app for that.

Why does FB ruin photo quality?

There's a reason for that: Facebook saves space on its servers by compressing the photos you upload, which will affect a picture's overall quality. This is a particularly bad problem for photos you've downloaded from elsewhere on the web that have likely already gone through at least one compression so far.


1 Answers

Getting the max size of a picture

/USER_ID?fields=images

images gives back "an array of objects containing width, height, source each representing the various photo sizes". The result looks like this:

{
  "data": [
    {
      "images": [
        {
          "height": 1536, 
          "width": 2048, 
          "source": "https://fbcdn-sphotos-c-a.akamaihd.net/hphotos-ak-prn1/s2048x2048/65169_XXXXXX_n.jpg"
        }, 
        {
          "height": 720, 
          "width": 960, 
          "source": "https://fbcdn-sphotos-c-a.akamaihd.net/hphotos-ak-prn1/65169_44590146XXXXXXXXn.jpg"
        }, 
        {
          "height": 540, 
          "width": 720, 
          "source": "https://fbcdn-sphotos-c-a.akamaihd.net/hphotos-ak-prn1/s720x720/65169_44XXXXXXX0984540_n.jpg"
        },
        { 
          ...
        },
        {
          "height": 97, 
          "width": 130, 
          "source": "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-prn1/s75x225/65169_44XXXXX_s.jpg"
        }
      ], 
    }
  ]
}

Getting the max size of a profile picture

Try with more than 960, i.e 961. You'll get the maximum size of the picture, if available!

/USER_ID?fields=picture.height(961)

Result:

{
  "id": "PROFILE_ID", 
  "picture": {
    "data": {
      "url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/615962_4486XXXXXXXXX3_601495975_o.jpg", 
      "width": 1536, 
      "height": 2048, 
      "is_silhouette": false
    }
  }
}
like image 126
Stéphane Bruckert Avatar answered Oct 05 '22 17:10

Stéphane Bruckert