Facebook, opengraph, how do they crop? - facebook

I have a website, with a simple 500x500 image listed appropriately in the <meta property="og:image" content="image.jpg" />
Facebook will sometimes crop and use the top of the image, the middle or in some cases the bottom to get it's required aspect ratio out of it. Is there anything I can do to control this? Or better yet, get it to take the entire square image in like every other social networking site does?
In my findings if your image is not 600x315 1200x630 or other 40:21 ratio facebook has a three step algorithm for determining what to crop as outlined below.
FINDINGS:
First Priortiy: Face detection. Detects center point of faces. If
multiple faces determines the ones that are closest together and bases
the crop on that.
Second Priority: Some sort of contrast detection: Detail > Colors >
Contrast. So if you had a picture of a face on the top of an image and
the rest of the image was blurred out because the picture was taken
with an extremely low aperture. Then, if you have a lot of colors in a
certain part of an image it would favor that and then if there was a
really dark image that had a bright white watermark in the bottom
right hand corner it would favor that.
Third Priority: This is more of a default, if the above two don't
work, it defaults to a center crop.

After researching on facebook I found this article about what image sizes and aspect ratio are recommended by facebook.
I haven't tried this personally, but this StackOverflow question says they have already tried what facebook recommended in the article.
I will try implementing image sizes recommended on facebook and will edit the answer appropriately.
Hope this helps.

Related

Unity Pixel Art Menu

As a beginner on Unity, I'm looking for a solution to a rather annoying problem. I've been through a lot of videos and articles, but I still can't solve it.
On a blank Scene, in a Canvas containing a Panel and an Image. I'm trying to display this image correctly. It is a pixel art image.
The problem is that it remains blurred and badly arranged according to the resolutions.
I try to find a way to display it correctly while keeping its pixel art aspect.
(I looked at the pixel perfect cameras, the stretch settings and others, I set the sprite parameters to Point and No compression and others. But nothing works).
I don't know how to propose different types of zoom according to the resolution and that the image doesn't blur
If someone has a little time, and can make me a scene just with his camera, and therefore the canvas, panel and image, with good setting so that I can understand my error. It would be a great help for me !
Thanks for reading !
The background picture :
Try selecting the image in the assets and change the Resize algorithm to Point(no filter)
Hop, I found the solution thanks to this threed :
Official - Pixel Perfect Preview Package
By looking correctly at the settings apply. It came from the resizing of the Canvas and the management of the Camera.
Thanks for your messages !
And thanks to the author of the threed : rustum !

How to keep the real width rate of the thumbnails on facebook share.php

I'm trying to use share.php and I already have some thumbnails on the site. Some of these thumbs are wide and when I try to share it on FB by share.php (p[images][0]) the FB popup cut the thumb to display the thumb. There is a way to avoid this behavior?
On my searchs I see that the best wasy is to have square images.
I would like to do something like this image below:
There is any way to do this?
Thanks in advance...
To not have your images resized (or avoid big cuts), you'll need to use images with 1.91:1 aspect ratio and at least 1200x630 pixels.
There is more information here on item 4: https://developers.facebook.com/docs/opengraph/howtos/maximizing-distribution-media-content/
As you already have many posts/articles in your website, you can use a script like timthumb (https://code.google.com/p/timthumb/) to generate a resized thumbnail with borders when the image is not in that aspect ratio.

Does Facebook expose the offset positioning for cropping a larger version of a user's profile thumbnail?

I've recently noticed that in the layouts for the new Timeline profile, Facebook is using the "normal" version (read: larger) of the user's profile image extensively, both on the Timeline and in the Friends List. As we all know, this image is retrieved by querying the graph with:
https://graph.facebook.com/[userid]/picture?type=normal
Of course, this image isn't a guaranteed square crop. However, Facebook uses element-level CSS to position and crop it manually (see image below). The positioning is interesting in that it's seemingly generated before page render.
See:
Notice how there's an element-level CSS style applied. In this case it's a top offset:
style="top:-50%"
I'm assuming that this is pulling the arbitrary offset/positioning value from somewhere (the graph, a db, etc.), not using some client-side JS for facial detection, since the process of setting a new Facebook profile picture (usually) involves manually cropping your face. See it for yourself: change your profile picture and if the proportions aren't square-ish, there's an intermediate, manual cropping step.
Furthermore, this image is posted to /photo.php with the x, y, width, height, and other various parameters passed. I know some of that is used to generate the 50x50 square crop, but it also has to be stored somewhere else, correct?
My question is whether or not Facebook currently exposes a method to retrieve these offset values so we can accurately square-crop the larger profile pictures without having to rely on facial recognition or client-side processing to guarantee that the subject is centered.
Answering my own question here.
Looking at http://developers.facebook.com/docs/reference/fql/profile/ I noticed it's possible to get the following with an FQL query to the profile table:
pic_crop| string
The URL to the largest-sized square profile picture for the object
being queried. The image is at least 100px in width. This URL may be
blank.
My emphasis on that last bit.
The response looks like this:
<fql_query_response list="true">
<profile>
<pic_crop>
<uri>https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/xxxxxx_xxxxxxxx_xxxxxxxxxx_n.jpg</uri>
<width>180</width>
<height>173</height>
<left>0.08468</left>
<top>0.06897</top>
<right>0.91532</right>
<bottom>0.93103</bottom>
</pic_crop>
</profile>
</fql_query_response>
Voila: Image size and crop positioning. The only caveat, naturally, is that last bit in bold. The URL might be blank.
Say hello to Shakira.
As you can see, the smallest one is crop version (manual + face recognition), it is easy to calculate relative position in middle image, when you have X & Y coordinates and W & H, they probably store it in database, and calculate percentage, server side. So far, I haven't seen they offer something like that. You can eventually calculate it with only these images, but that will cost you. Set background image to center center and hope for the best :)
I'm facing the same problem. pic_crop as for documentation contains the pixel co-ordinates of the user selected crop for this profile picture.
It means that if the user hasn't selected a 160x160 crop, you will get a portrait or landscape.
This is confirm by the data that I'm receiving from my tests:
{
"uri": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/xxxxxxxxx_n.jpg",
"width": 180,
"height": 286,
"left": 0,
"top": 0,
"right": 1,
"bottom": 1
}
From these information I can't understand how to make a 160x160 proper crop centering the face

What is the Fb.ui feed picture size limits?

I'm using the Fb.ui feed and I'm trying to find the picture size limits/requirements. Not all of my images appear using the feed, and I'd like to know exactly what the image requirements are. This is not well documented.
I'm pretty sure the open graph image rules apply:
An image URL which should represent your object within the graph. The
image must be at least 50px by 50px and have a maximum aspect ratio of
3:1. We support PNG, JPEG and GIF formats. You may include multiple
og:image tags to associate multiple images with your page.
What is the size of the image you are unable to post?
From my testing, the max size is 320x320. It'll keep your aspect ratio within those bounds.

Zooming a hotspot when it clicked

I have to make some hot spots on my image , so that when i click anyone of them they zoom.
For example consider the image
When i click that butterfly then it zoom
Please provide a good solution
Following are my thinking
Use a button and click it and add a subImageView and zoom it.
Zoom a particular region of this image when touch at that place.
Both ideas have their limitations.In first i have to create a saperate image and also my app size will become very large.
and limitation of second is that it will not zoom exact required image.
I was also thinking of masking but i think that is also not very good way, because this is just a sample, i have many images like this and can be many hot spots on a single image.
please guide.
If you are dealing we rather large images you should check out CATiledLayer, which are very fast and efficient to use.
Check out this blog post, including the demo app:
http://www.cimgf.com/2011/03/01/subduing-catiledlayer/