Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Some of my images have been taken rotated but kept this data. The problem is that, when using mogrify to convert them from JPG to png, that data seems to dissapear. For showing this problem, I think the best is to show the script and an screenshot.

Script with the code. Put it in a text file, give it execution permission, double click, run (from terminal if you wish) and wait a while. All the JPGs in that folder will be converted to png.

#! /bin/bash
echo "Converting JPG to png. Please don't close this window."
mogrify -alpha on -format png *.JPG
mogrify -alpha on -format -alpha on png *.jpg

It works great and adds an alpha channel. This is personally useful when I edit them later, not to add the channel individually.

Now the screenshot that illustrates the problem:

Showing the rotating problem

As you can see, the original ones' (JPGs) preview is right, the modified preview is wrong, the Shotwell rendering is right and the GIMP edit is wrong and didn't even say the image was rotated, as it uses to do with other images.

How can I edit my script to preserve the orientation?

share|improve this question
add comment

1 Answer

I was googling 'Rotated image' and similar terms. Though when I formulated the last question, "How can I edit my script to preserve the orientation?", it came to me and googled for 'orientation'. Since the full question was already finished and it can help someone out there, I answer it.

The solution came from this forum.

Same instructions: Put this in a text file, give it execution permissions, double click and run (in terminal) for converting all JPGs from that folder into pngs.

#! /bin/bash
echo "Converting JPG to png. Please don't close this window."
mogrify -alpha on -auto-orient -format png *.JPG
mogrify -alpha on -auto-orient -format -alpha on png *.jpg

Here is the finished working script and a screenshot to show it Fixed screenshot

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.