I am aware of the many existing questions about FB's Graph API and how to retrieve full sized images.

But many of them are about getting user profile pictures, those are answered with "/<userid>/picture" or anything similar. I need to know how to get posted images from a page feed, so this is not what I'm looking for. Then there are questions answered with "use full_image in your search query".

Well, at this point my problem begins. full_image actually isn't the full image. It's limited to 720x720 pixels.

Let's have a look at an example: explore this picture from SPIEGEL ONLINE in Facebook's Graph API explorer.

The given path for the Graph API request is:

/38246844868_10154299256109869?fields=full_picture,picture,permalink_url,type,object_id

The response is the following:

{
  "full_picture": "https://scontent.xx.fbcdn.net/v/t1.0-9/s720x720/13450864_1068539139897737_5236884236245491903_n.jpg?oh=20cc415e7931b8eb8a6228ab253bfa53&oe=57E23B8B",
  "picture": "https://scontent.xx.fbcdn.net/v/t1.0-0/s130x130/13450864_1068539139897737_5236884236245491903_n.jpg?oh=37c4263e047f841da7243c040a4f279d&oe=57C6469E",
  "permalink_url": "https://www.facebook.com/spiegelonline/posts/10154299256109869",
  "type": "photo",
  "object_id": "1068539139897737",
  "id": "38246844868_10154299256109869"
}

As you can see I requested the picture (which is just a thumb) and the full size image indexed by full_picture. Unfortunately this picture is not full, but a resized one instead. It's even mentioned in the image's URL that it's only 720x720 at max.

Here it is: https://scontent.xx.fbcdn.net/v/t1.0-9/s720x720/13450864_1068539139897737_5236884236245491903_n.jpg?oh=20cc415e7931b8eb8a6228ab253bfa53&oe=57E23B8B

When visiting the Facebook page behind the permalink_url you get to the image post.

Here we go: https://www.facebook.com/spiegelonline/posts/10154299256109869

When opening the posted image in fullscreen mode and then right-clicking it to show the image file you will see that the image will be much larger that 720x720.

There it is: https://scontent-frt3-1.xx.fbcdn.net/t31.0-8/13422344_1068539139897737_5236884236245491903_o.jpg

Please, compare the URL with the one responded by the API endpoint as shown above. Even the servers are different. So, there isn't an easy solution by replacing "_n" with "_o" as mention in several other questions here on SO.

My question is: How do I get the full size image URL using Graph API?

TL;DR: Facebook's Graph API seems to deliver resized images posted to a page's feed by accessing them with full_image. So, how to retrieve the actual full (meaning non-resized) image.

1

There are 1 best solutions below

2
On BEST ANSWER

I finally found a solution after playing around again with the Graph API Explorer. And it's much simpler than I thought.

All you need to do is the following few steps:

  1. Just request this path (this time without the full_picture accessor, only the object_id is important here):

/38246844868_10154299256109869?fields=object_id

  1. Grab the object_id from the API's response:
{
  "object_id": "1068539139897737",
  "id": "38246844868_10154299256109869"
}

In this example it's "1068539139897737".

  1. Now, request all images for the above object_id:

/1068539139897737?fields=images

  1. The response is a JSON like this:
{
  "images": [
    {
      "height": 2048,
      "source": "https://scontent.xx.fbcdn.net/v/t31.0-8/13422344_1068539139897737_5236884236245491903_o.jpg?oh=e923e167d258e77c12caf422d98b44aa&oe=59968118",
      "width": 1536
    },
    {
      "height": 1280,
      "source": "https://scontent.xx.fbcdn.net/v/t31.0-8/p960x960/13422344_1068539139897737_5236884236245491903_o.jpg?oh=7a5086e29957b222c2fd1136f3640c98&oe=598633CD",
      "width": 960
    },
    // … many others in between here …
    {
      "height": 225,
      "source": "https://scontent.xx.fbcdn.net/v/t1.0-0/p75x225/13450864_1068539139897737_5236884236245491903_n.jpg?oh=26d94247c4e34a69fb0db3fb1ae213b5&oe=599353F9",
      "width": 168
    }
  ],
  "id": "1068539139897737"
}
  1. From the images list which is down-sorted by size just grab the very first entry. Get its source – et voilà – this is the full picture.