7

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?

Stéphane Bruckert
  • 21,706
  • 14
  • 92
  • 130
jbkkd
  • 1,510
  • 5
  • 18
  • 37

1 Answers1

15

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
    }
  }
}
Stéphane Bruckert
  • 21,706
  • 14
  • 92
  • 130
  • What do you mean by that? when trying something like this: `select src_big from photo where object_id = 10151151370658685 and src_big_width = 960`, I get no data back – jbkkd Dec 23 '12 at 09:40
  • Thanks, works like a charm. I still wonder though why src_big doesn't return the biggest image available – jbkkd Dec 23 '12 at 17:24
  • It seems like there is no FQL equivalent for "/USER_ID?fields=picture.height(961)". I was looking for hours, did anyone find FQL to retrieve full profile image size by given UID (user ID) only? – AmitP May 09 '13 at 16:38
  • it is not clear for me how it is possible to get images with 2048px if facebook is storing images with max 960px :( ... can you please explain ? – fvisticot May 17 '13 at 22:03
  • @AmitP The FQL equivalent is `select images from photo where object_id = PHOTO_ID`. Just get the first picture in the `image` array. @fvisticot You'll always get the biggest size. If there is no big picture available, it means that the photo has not been uploaded as _high definition_. – Stéphane Bruckert May 19 '13 at 08:45
  • 2
    This is gold: /USER_ID?fields=picture.height(961) thanks a lot :) – Kaan Soral Oct 04 '13 at 02:02
  • 2
    Can I get timeline photos ? – Vineesh TP Oct 13 '14 at 09:53
  • I know it's ten years later, but I wanted to point out that this method doesn't work for obtaining photos attached to a page's feed. I can only get medium resolution photos in that case, with no other options. Still looking for a solution. – Simon East Jan 13 '23 at 14:31
  • A couple of hours later, I found [a solution here](https://stackoverflow.com/a/75111901/195835) for obtaining high resolution photos attached to a page's feed. – Simon East Jan 13 '23 at 16:31