ImageMagick
From Noah.org
ImageMagick is your friend, but it has terrible man pages (they basically just tell you to go to the web site and read docs in a browser).
Convert all images in a directory from one format to another
This is easy. Use Mogrify, not Convert. The following example converts all PNG files to JPEG:
mogrify -format jpg -quality 85 *.png
I always forget this. Maybe it's because the ImageMagick docs say:
Mogrify overwrites the original image file, whereas, convert writes to a different image file.
Which is true unless you want to convert a group of images. In that case, you use Mogrify instead of Convert. Why? I would call this a bug. If you try this with Convert it will not work (and will, in fact, destroy the last image in your directory).
It sure beats doing it this way:
for i in *.png
do
echo $i
convert -quality 85 $i `basename $i .png`.jpg
done
Remove Transparency
This will turn all transparent pixel in an image to the given color.
convert input.png -fill white -opaque none output.png
Working with RAW files (NEF)
Sometimes I have to work with raw image files from a Nikon D2X (saved as NEF file). ImageMagick cannot work directly with raw NEF files. You need to install a few extra tools: netpbm and dcraw.
aptitude install netpbm dcraw
The `dcraw` command converts raw files from various cameras to PBM format. The netpbm commands are used to convert the PBM format to something easier for ImageMagick to deal with.
Convert all NEF images to PNG:
dcraw -c -w input.NEF | pnmtopng > output.png
To convert an entire directory:
for filename in *.NEF ; do dcraw -c -w $filename | pnmtopng > $filename.png ; done