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
    So basically, if you rotate an image 90 degrees to the left you want the image itself to be rotated in the data 90 degrees to the left? Not via info stored in the EXIF data, correct? – Giacomo1968 Aug 31 '15 at 12:06
  • Exactly. I need that because Github README.md files doesn't understand EXIF. – Jasmine Lognnes Aug 31 '15 at 12:07
  • Bingo! I posted a fuller answer, but I believe the issue you are running into is the fundamental difference between saving an image in a modern image editing program versus exporting an image. My answer goes into more detail, but I believe if you were to export a JPEG via GIMP you will get the exact results you want without having to deal with EXIF data being favored for transforms like scaling and rotation. – Giacomo1968 Aug 31 '15 at 12:23
  • Using GIMP's export on an exif stripped jpeg added a new one. – Jasmine Lognnes Aug 31 '15 at 13:14
  • Yes, it might have added new EXIF data, but was the actual image data changed to match orientation as your question asked? – Giacomo1968 Aug 31 '15 at 13:35
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.

| improve this answer | |
  • 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? – Jasmine Lognnes Aug 31 '15 at 13:12
  • 1
    @JasmineLognnes I haven’t actually used any of these tools myself—but this question is a good reference for tools I should investigate—but it seems to me that exiftran and jpegtran might be what you are looking for. I would experiment with the options both of those tools have and see what happens. Best I can do. Good luck! – Giacomo1968 Aug 31 '15 at 13:25
  • 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 '15 at 20:00
  • @fixer1234 Yeah, I saw that myself when I checked low quality posts earlier. Hilarious! It might have been triggered by the amount of various links to disparate packages I am recommended. But hey! I am happy there is some automated policing mechanism that at least has a human filtering component. – Giacomo1968 Sep 6 '15 at 20:02
2

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).

| improve this answer | |
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.
| improve this answer | |
  • 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 '18 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).

| improve this answer | |
  • Yes, it is great for that, but when I edit the images afterwards, then new EXIF headers are added. – Jasmine Lognnes Aug 31 '15 at 13:00
  • 1
    EXIFTool can remove the data, but it won’t alter, rotate or scale and image. It will just wipe that data away and the JPEG will then display in whatever raw format it originally existed in. This is useful in some cases, but not in a case like this. – Giacomo1968 Aug 31 '15 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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