DeutschEnglish

Submenu

 - - - By CrazyStat - - -

21. August 2020

Linux: Turn jpeg images lossless out of Nautilus

Filed under: Linux — Tags: , , , , , , — Christopher Kramer @ 22:13

Your camera does not always turn your images the correct way? You search for an easy way to turn multiple images in linux?

That’s the problem I just came across. And this is my solution:

In Nautilus, the default file manager in Ubuntu Linux and a lot of other linux distributions, you can easily run scripts out of the context menu. All you have to do, is place your script in the following directory:

~/.local/share/nautilus/scripts/SCRIPTNAME

Nautilus will pass the selected files as parameter. So all we need to do, is write a script that turns our image. I was searching for something that can turn .jpeg-images in a lossless way. This means, turning the image won’t reduce the image quality. A good tool for this job is jpegtran, which can be installed like this in Ubuntu:

sudo apt install libjpeg-progs

Now create the file ~/.local/share/nautilus/scripts/jpeg turn 90 with the following content:

#!/bin/bash
for FILE in "$@"; do
        jpegtran -rot 90 -outfile "$FILE" "$FILE"
done

Now you can right-click jpeg files and turn them easily in Nautilus:

You can even select multiple images in Nautilus and turn all of them at once.

Now create jpeg turn 180 and jpeg turn 270 scripts with 180 and 270 after -rot instead of 90 in the script. This way, you can easily turn images by 180 or 270 degrees as well.

If this made your day, please drop a comment.

Recommendation

Try my Open Source PHP visitor analytics script CrazyStat.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment