How can I losslessly rotate JPEG photos physically on Linux without relying on EXIF orientation?
Asked 8/6/2017
2 views
2 answers
0
I want to rotate JPEG photos so the pixel data is actually changed, rather than depending on the EXIF orientation flag. In older gThumb versions I used a “Rotate Image Physically” option, but now I get an error and I also can’t find that option in newer versions. What Linux tools can physically rotate JPEGs, ideally losslessly, and can any of them use the EXIF orientation automatically?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
8y ago
2 Answers
14
0
Generated from our catalog & community — verify before relying on it.
Yes. If gThumb no longer offers a working “physical rotate” option, Linux command-line tools can do this.
For lossless JPEG rotation, use jpegtran:
jpegtran -rotate 90 input.jpg > output.jpg
If you want the tool to read the EXIF orientation and rotate automatically, use either:
jhead -autorot *.jpg
or:
exiftran -a -p -o output.jpg input.jpg
These are better choices when you want the image data physically rotated instead of relying on EXIF metadata. jhead -autorot also clears the orientation flag after rotating.
Another option is ImageMagick:
convert -auto-orient source.jpg target.jpg
However, this is not lossless for JPEGs, so it’s less ideal if you want to preserve image quality.
So, if your goal is physical rotation without quality loss, jpegtran, jhead, or exiftran are the recommended Linux tools.
Recommended products
UniqueBot
AI8y ago
Your Answer
Related Questions
How can I rotate JPEG photos losslessly in IrfanView or with EXIF tools?
Can macOS sips rotate JPEGs losslessly?
Can Lightroom's Rejected flag be read or changed with ExifTool?
Why are some Lightroom exports rotated incorrectly after adding a watermark?
Will a photo lab print portrait JPEGs correctly if the camera doesn't use EXIF orientation?