PHP read_exif_data and Adjust Orientation

I am using the following code to rotate an uploaded jpeg image if the orientation is off. I am only having problems with images uploaded from iPhones and Android. if(move_uploaded_file($_FILES[‘photo’][‘tmp_name’], $upload_path . $newfilename)){ chmod($upload_path . $newfilename, 0755); $exif = exif_read_data($upload_path . $newfilename); $ort = $exif[‘IFD0’][‘Orientation’]; switch($ort) { case 3: // 180 rotate left $image->imagerotate($upload_path . … Read more

Detect EXIF Orientation and Rotate Image using ImageMagick

Canon DSLRs appear to save photos in landscape orientation and uses exif::orientation to do the rotation. Question: How can imagemagick be used to re-save the image into the intended orientation using the exif orientation data such that it no longer requires the exif data to display in the correct orientation? Answer Use the auto-orient option … Read more

In Python, how do I read the exif data for an image?

I’m using PIL. How do I turn the EXIF data of a picture into a dictionary? Answer You can use the _getexif() protected method of a PIL Image. import PIL.Image img =‘img.jpg’) exif_data = img._getexif() This should give you a dictionary indexed by EXIF numeric tags. If you want the dictionary indexed by the … Read more

How to remove EXIF data without recompressing the JPEG?

I want to remove the EXIF information (including thumbnail, metadata, camera info… everything!) from JPEG files, but I don’t want to recompress it, as recompressing the JPEG will degrade the quality, as well as usually increasing the file size. I’m looking for a Unix/Linux solution, even better if using the command-line. If possible, using ImageMagick … Read more

JS Client-Side Exif Orientation: Rotate and Mirror JPEG Images

Digital camera photos are often saved as JPEG with an EXIF “orientation” tag. To display correctly, images need to be rotated/mirrored depending on which orientation is set, but browsers ignore this information rendering the image. Even in large commercial web apps, support for EXIF orientation can be spotty 1. The same source also provides a … Read more