Trying to pull user images via the Facebook Social Graph.
Finding it odd that no matter what I upload the image as (gif, bmp, tiff, or jpg), my call to https://graph.facebook.com/507988137/picture?type=large (my pic) always returns a jpg.
Does anyone know if I'm OK assuming that his image is always a "jpg"? I'm using php get_file_contents to pull the images & would prefer not having to sniff test them for various formats.
Facebook doesn't save the original image that you upload. Instead it converts all uploaded images to jpgs of 4 different sizes to support all the different places where the image may be displayed.
In case you are interested, Facebook basically has this down to a science, in fact, I've read several times that they are the largest image hosting service in the world. More details within this Facebook blog post, Facebook Photos Infrastructure
That's because FaceBook stores it as a jpg, because that is in general the most efficient image format for pictures.
It's always a good idea to check if the data is what you expect. Checking image type is quite easy. It will always be a web format, which basically comes down to jpg, png and gif, with gif being very unlikely because of its limitations (GIF can contain 256 colors at most, and is generally larger than png. Has license limitations too).
BMP is not a web format and cannot be displayed in most browsers. You will not get a BMP from that url.
make sure you also handle the case where a gif is returned to you.
This is the default profile pic for users that doesn't update their profile pic
Related
First, thanks for any and all help regarding this topic.
Sites like Facebook and Twitter strip EXIF information from images as they are uploading. My goal is to allow users to upload images to our platform (working with Nextcloud and others) with full EXIF information, however, we need to display images that do not contain EXIF information or any metadata. Without stripping and creating a second, Exif-Free image for each, is it possible to simply hide that EXIF info so that, if a user downloads that image, the EXIF is not embedded?
We were told that the only way to do this is to have a second, exif-free copy (the order of when that's created is irrelevant pre/during/post upload). I'm hoping there's a way that we can simply display such a copy without doubling our physical space requirements.
Thanks again for your help.
Exif is metadata, along with IPTC, XMP, AFCP, ICC, FPXR, MPF, JPS and a comment, just for the JFIF/JPEG file format alone. Other picture file formats support even more/other metadata.
You wrote it yourself: a download - so it's a file in any case. Pictures are files, just like executables, movies, texts, music and archives are files, too. And metadata is part of its content, so whoever accesses the raw bytes of the file can grab everything in it. Which is not "please don't look" proof. If you
create that on the fly by stripping metadata everytime a download is requested,
or if you do it once to preserve performance and instead occupy space remains your decision.
If there would be something as simple as a "don't show" feature then it would still be in the file and could be extracted easily by software written to ignore that instruction. Seriously, there's no shortcut to that - do it properly and don't spare yourself from getting work done at the wrong end.
I've been scanning some old family photos and posting them to Facebook. On the back is some information like the date or who is in the photo. So I'm dutifully entering that info into Facebook as well. But now the metadata is in Facebook, not connected to the picture itself.
If I copy/paste my scanned images subfolder, there's no metadata about who or when these pictures are from.
Is there a way to embed that info into a jpg or png?
There are ways to do this in both PNG and JPEG. The simplest way in JPEG is to inset a COMment marker with your text into the stream. You could do that with a simple C program without having to recompress the data. Just insert the comment marker after the SOF and APPn marker---it could even be write before the EOI (end of image) marker).
Some JPEG file formats (e.g. EXIF) have various predefined tags but that is format specific.
For that you'd need some image viewing application that would allow you to set the tag values.
I've noticed there are two different ways facebook shows an open graph story with an image in a users' feed: one with a small image and the title and description next to it (example), and one with a larger image with the title and description beneath it (example).
Following a tutorial, I was able to generate the large images. However, now that I'm leaving the tutorial and designing my own script, my posts are always shown with the small image.
Anyone has an idea what's causing this? I'm pretty sure both methods use <meta property="og:image" content="someimage.jpg" />
In order to get the large image format your images must be at least 200x200. However, with the new News Feed rolling out soon, you'll want to make your images even larger. Facebook is now recommending 1200x630 images.
Note that even if you are using an image this large, Facebook may still display your story with a smaller image format. Facebook attempts to auto-optimize the format that it shows to people by continually running A/B tests, and so your posts may show up in any of the available image formats.
We recently wrote a blog post showing the different image formats which you may find helpful.
Use an image that is at least 1200 width by 630 height.
Use the Facebook DEBUG tool to call your page again, thereby clearing the Facebook cached version that you uploaded previously at a smaller size:
https://developers.facebook.com/tools/debug/
Since the past few months, I've been noticing that they tend to some kind of pixelated image first which then gets replaced by a much better image.
Is this some kind of trick to reduce perceived latency by facebook?
Or is it Chrome doing it?
i think it's progressive image rendering. Quote from the linked blog
Images already render progressively in a web browser -- but you can do even better. Simply save your GIF or PNG images with the "interlaced" option, or your JPEG images with the "progressive" option.
This blog might answer your query - checkout following links -
Image Optimization Part 3: Four Steps to File Size Reduction
Image Optimization Part 4: Progressive JPEG…Hot or Not?
I would like to add some custom data to an image the user generates in my app, no more than 1kb tops. I could probably hide the data in the image, but I want to do this in a way that will resist resizing but not deliberate deletion of EXIF tags (say, for privacy reasons).
Is this possible using the current public SDK 3.0?
this might be helpful, though i've never used it before - iphone-exif
This could be very useful: PhotoshopFramework is one powerful library to manipulate images on Objective-C. This was developed to bring the same functionalities that Adobe Photoshop users are familiar. Examples: Set colors using RGB 0-255, apply blend filers, transformations...
Is open source, here is the project link: https://sourceforge.net/projects/photoshopframew/