Display higher quality images for Facebook posts for iOS

I use the Facebook SDK so that users can share content through my app with their Walls. Its a pretty standard setting using the Facebook SDK, where a typical post will contain text as well as an image to accompany the message.

All this works great, but my problem is that since Facebook resizes and transforms the images as it sees fit, images with images look a bit jagged when viewed on a Retina display. Does anyone know if there is a way to ensure that Facebook uses a better image for this?

Again, to clarify, the original images that I use are of high enough quality, but Facebook degrades them too much and they don't look too good on the Retina display. Can we somehow avoid this?

Below is an excerpt from the standard Facebook postcode that I use;

NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: sharingURL, @"link", sharingTitle, @"name", @" ", @"caption", description, @"description", actions, @"actions", picture, @"picture", nil]; [facebook dialog:@"feed" andParams:params andDelegate:self]; 

Please note that the images I am linking are about 250x250 pixels jpg if that helps.

EDIT : A sample image has been added to clarify what I mean. I'm trying to see if there is a way to ask Facebook to use a high resolution image for retina displays.

Post image and how it looks on FB

Thanks in advance!

+8
ios iphone image facebook
source share
3 answers

You can update your photo in the user's photo albums. This will also lead to a wall pillar. (If this also works in your case.) This will be the code:

 // save image as data UIImage* image = [...]; NSData *imageData = UIImageJPEGRepresentation(image, 0.8); [params setValue: imageData forKey: @"source"]; // send post request Facebook* facebook = [...]; [facebook requestWithGraphPath: @"me/photos" andParams: params andHttpMethod: @"POST" andDelegate: delegate]; 

(Note: Uploaded images for albums must be less than 960 pixels on each side. See the Documentation for Facebook )

+1
source share
 if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2) { //iPhone 4 //Use @2x images here NSLog(@"iPhone 4"); } else { //iPhone 3 or earlier //Use original images here NSLog(@"iPhone 3 or earlier"); } //May this will help you. 

I would suggest you change the image source according to the device, and make it dependent on FB.

0
source share

All Articles