Linux Titbits
1. flips large number of jpeg images in current directory
#########################
# Flip
find -name '*.jpg' -exec jpegtran -rot 180 -outfile "{}.flip" {} \;
# Rename over originals
find -name '*.flip' -exec rename 's/\.flip$//' {} \;
One of no doubt many alternatives is to use: 'mogrify' which
seems like a very handy command (as suggested by Peter Gawthorp).
something allong the lines of:
mogrify -rotate 180 *.jpg
nb. if there are too many images in the one directory you will need to
use find:
find -name '*.jpg' -exec mogrify -rotate 180 {} \;
I don't know if mogrify manages not to decompress and recompress the
jpegs as jpegtran avoids, maybe it does.
2. make a reasonable movie from sequence of jpegs using
mencoder/mplayer
mencoder "mf://*.jpg" -mf fps=30 -o output.avi -ovc lavc
-lavcopts vcodec=mpeg4:vhq:vbitrate=1800
3. convert set of jpegs to pnms
In one go:
find -name '*.jpg' -exec echo 'jpegtopnm {} > {}.pnm' \; >
/tmp/tmpcmd && cat /tmp/tmpcmd | sed 's/\.jpg\.pnm$/\.pnm/'
> /tmp/tmpcmd && chmod u+x /tmp/tmpcmd &&
/tmp/tmpcmd && rm /tmp/tmpcmd
bit by bit:
find -name '*.jpg' -exec echo 'jpegtopnm {} > {}.pnm' \; >
/tmp/tmpcmd &&
cat /tmp/tmpcmd | sed 's/\.jpg\.pnm$/\.pnm/'
> /tmp/tmpcmd &&
chmod u+x /tmp/tmpcmd &&
/tmp/tmpcmd &&
rm /tmp/tmpcmd