Azitech

Azimout's Linux weblog

Rotate JPEG images with Nautilus scripts

leave a comment »

All information below is a summary of this article.

Packages needed: jpegtran (included in libjpeg62) and jhead. Run command:

 sudo apt-get install libjpeg62 jhead

Then create three scripts under ~/.gnome2/nautilus-scripts/img/:

rotate_clockwise.sh

#!/bin/bash
while [[ -n "$1" ]]; do
	#if a file and not a dir
	if [[ -f "$1" ]]; then
		#by default, jpegtran will only copy some
		# Exif data, so we'll specify "all"
		jpegtran -rotate 90 -copy all -outfile "$1" "$1"

		#clear rotation/orientation tag so that
		# some viewers (e.g. Eye of GNOME)
		# won't be fooled
		jhead -norot "$1"
	fi
	shift
done

rotate_counterclockwise.sh
Change rotate 90 with rotate 270

Then make the scripts executable:

chmod +x ~/.gnome2/nautilus-scripts/img/*
Advertisements

Written by azimout

09/10/2007 at 09:20

Posted in Howto

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: