10

Is there such a thing as a simple image editor for Linux which allowed for scaling and rotating the image without using EXIF data for the scaling and rotation?

So far have I tried EOG, Shotwell, and GIMP and when I rotate the images, they store it in the EXIF header. This I don't want.

Even if GIMP could do it, it is much too time consuming as it requires tons of mouse clicks when dealing with JPEG files.

2
  • Exactly. I need that because Github README.md files doesn't understand EXIF. Aug 31, 2015 at 12:07
  • Using GIMP's export on an exif stripped jpeg added a new one. Aug 31, 2015 at 13:14

4 Answers 4

15

Is there such a thing as a simple image editor for Linux which allowed for scaling and rotating the image without using EXIF data for the scaling and rotation?

Saving Versus Export

I know you state you don’t really want to do this in GIMP, but in my experience the issue you are running into—software favoring EXIF orientation data over actually transforming pixels in the image—boils down to the difference between exporting an image and saving an image.

In the past, 100% all image editors in the world would actually transform/modify pixels when dealing with simple orientation transforms. It’s only relatively recently that image editing programs defer to using EXIF data to store some physical transformation data.

Why? Easy. Since the JPEG format is a lossy format—even when quality is set at 100%—resaving a JPEG for simple things like image rotation will slowly degrade the data. In contrast by storing that data as EXIF info, the raw JPEG image is left untouched but the transformation data is passed along so you can see the image rotated without degrading the image in the process.

This is where the export concept comes into play. Many image editing programs such as GIMP allow one to export an image which would basically mean modify the image data itself and optimize it for use in non-image editing software.

So while there might be other software tools that explicitly modify image data for tasks like rotation out there, it might be overkill to install and use them. Instead I would recommend simply experimenting with export functionality in whatever image editing software you are using; whether it be GIMP, Photoshop or something else.

Batch Processing

All that said, you do mention how GIMP might be too time consuming for your needs. Unclear what your exact workflow is, but if you have a folder/directory filled with JPEGs you might need to process, I would recommend investigating the tools mentioned in this other answer:

  • exiftran: A tool used to transform digital camera JPEG images which can do the following:

It can do lossless rotations like jpegtran, but unlike jpegtran it cares about the EXIF data: It can rotate images automatically by checking the exif orientation tag, it updates the exif informaton if needed (image dimension, orientation), it also rotates the exif thumbnail. It can process multiple images at once.

  • JHead: Specifically using jhead with the -autorot option which is described as:

Using the 'Orientation' tag of the Exif header, rotate the image so that it is upright. The program 'jpegtran' is used to perform the rotation. This program is present in most Linux distributions. For windows, you need to get a copy of it. After rotation, the orientation tag of the Exif header is set to '1' (normal orientation). The Exif thumbnail is also rotated. Other fields of the Exif header, including dimensions are untouched, but the JPEG height/width are adjusted.

This feature is especially useful with newer digital cameras, which set the orientation field in the Exif header automatically using a built in orientation sensor in the camera.

Here is another tool mentioned in this other thread:

  • NConvert: NConvert is the multi-format commandline image converter for Win32, Linux, DOS, OS/2, and other platforms. Quick-start details seem to be here. And it appears that if you use nconvert with the -jpegtrans option that is exactly what you are looking for. But I wonder if that just uses the same library/core functionality of jpegtran as this other answer on this question recommends?

Finally, perhaps using the ImageMagick convert tool with the -auto-orient option would work for you?

-auto-orient

adjusts an image so that its orientation is suitable for viewing (i.e. top-left orientation).

This operator reads and resets the EXIF image profile setting 'Orientation' and then performs the appropriate 90 degree rotation on the image to orient the image, for correct viewing.

This EXIF profile setting is usually set using a gravity sensor in digital camera, however photos taken directly downward or upward may not have an appropriate value. Also images that have been orientation 'corrected' without reseting this setting, may be 'corrected' again resulting in a incorrect result. If the EXIF profile was previously stripped, the -auto-orient operator will do nothing.

2
  • It would be perfect if a commandline tool could do the actual pixel rotation based on EXIF and then clear the EXIF info afterwards. Is that possible? Aug 31, 2015 at 13:12
  • 1
    You might find it humorous that the system selected this answer as an audit test in the LQ Post review queue. I voted to not delete it, BTW, and apparently, that was the right answer. :-)
    – fixer1234
    Sep 6, 2015 at 20:00
3

I usually use jpegtran to rotate photographs:

jpegtran -copy all -rotate 90 -outfile newimg.jpg oldimg.jpg

90 rotates right, use 270 for left (and 180 for flip).

2

When exporting in GIMP you can click Advanced in the popup just before saving where you can disable EXIF and XMP.

The overall algorithm to script it:

  1. For each file.
  2. Save value from exiftool * | grep Orientation.
  3. Remove exif with exiftran -ai *.
  4. Use convert -rotate with value from step 2.
1
  • This is exactly what I was looking for. A way that detects if the image is rotated and then a way to rotate it based on that. Thanks!
    – xarlymg89
    Apr 24, 2018 at 9:27
0

You can use Exiftool to remove EXIF data from JPEG images. Then you can rotate the image by anything (like convert).

1
  • Yes, it is great for that, but when I edit the images afterwards, then new EXIF headers are added. Aug 31, 2015 at 13:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .