Exiftran is a command line utility to transform digital image jpeg images. 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.
exiftran -ai *
This will transform all the images in a folder, rotating them to the correct orientation as defined by the exif data from the camera and replace the original, assuming your camera can sense and write the orientation into exif data.
exiftran -i9 *
Transform the image through 90degrees (to the right) and overwrite the original.
exiftran -i2
Transforms the image through 270degrees (to the left) and overwrite the original.
I have adapted this into two scripts in my nautilus-scripts folder "/home/subbass/.gnome2/nautilus-scripts/" you can make two scripts in this place using the following code and just changing the exiftran command to rotate left or right in each of the scripts.
#!/bin/sh
for arg; do
filetype=`file -i "$arg"`
if [ -n "`echo $filetype | grep -i '.jpg' `" ]; then
exiftran -i9 "$arg"
else
convert -rotate 90 "$arg" "$arg"
fi
done
The convert at the end is to convert other image formats without me requiring another set of scripts, feel free to omit this if desired. Always do a small test before setting any script to work on large numbers of images, I don't want to be held responsible if your exif data gets nuked.
I no longer use Ubuntu, Old articles will remain but from 2013/11 everything will be related to Debian.
Showing posts with label loop. Show all posts
Showing posts with label loop. Show all posts
Sunday, 31 August 2008
Wednesday, 13 August 2008
Unpack multiple zip files easily
So you have just completed a download and it is in multiple zip files, rather than unpack them in the gui one at a time try this.
Open a terminal and 'cd' to the folder containing the zips, then enter this command:
for FILE in *.zip; do unzip -jo $FILE; done
I would suggest having the zip files in a separate folder to anything else to avoid confusion over the files that get unpacked.
Open a terminal and 'cd' to the folder containing the zips, then enter this command:
for FILE in *.zip; do unzip -jo $FILE; done
I would suggest having the zip files in a separate folder to anything else to avoid confusion over the files that get unpacked.
Subscribe to:
Posts (Atom)