postheadericon Magento EXIF rotation problem for images made with iphone


I had a problem with someone uploading images to his magento store (magento 1.9.1) that he made with his iphone.

The images did not come out right in the front or backend of magento. (landscape / portrait orientation was mixed up)

After some time looking on google the conclusion was that the resize system used in magento strips the EXIF data from the jpg images. Making the image orientation incorrect. (landscape / portrait).


Thus i had to come up with the most user friendly (and budget friendly) solution to:

1. set  the right orientation according to the EXIF orientation tag

2. remove ALL the EXIF data from the jpg

3. while i'm at it, resize the image to be more web friendly (iphone image size was nearly 2MB)


I did not want to make some extra code in magento, or create an extra page to convert the images (time is a rare thing)



I ended up with an easy way for him to right click his picture on his windows desktop and just select the 'send to' option to convert his image.


This is how i went about it:

So i looked at some freeware programs that could do the job before the images are uploaded.

After playing around with XnConvert, i got the images exactly like i wanted to.

But going about all the steps in the program, seemed like to much of a hassle just to get the image right.

So on wards with the search.


Seems like the maker of XnConvert also has a command line tool to make .bat files ( nconvert )

So this is what i did.

1. Download and extract nconvert ( ) into "C:\Program Files\XnView\"

2. Open up the windows explorer (not the explorer web browser) and enter shell:sendto in the address bar (this will open up the folder containing the items in the right click menu on files)

3. Create a .bat file in this folder eg. image.bat

4. Open up the .bat file with notepad and enter the following text:

@echo off
set FILE=%1

set FILENAME=%~nx1
"C:\Program Files\XnView\nconvert.exe" -jpegtrans exif -overwrite %FILENAME%

"C:\Program Files\XnView\nconvert.exe" -ratio -rflag orient -resize longest 1000 -overwrite %FILENAME%

5. Save the file and try it!!!

The images are now oriented correctly, and they have been resized to 1000px for the longest side. going from nealry 2MB to less then 100KB


Last Updated (Thursday, 05 November 2015 00:41)


Add your comment

Your name:
Your email:
Your website: