2007-10-10

Lossless JPEG Transformation

Installation

Trim JPEG images (*almost* loseless)

mc menu
1   jpgzap
    set %t
    while [ -n "$1" ]; do
        /bin/echo -n Cleaning $1 $(du -b $1 | sed 's/\([0-9]*\)\(.*\)/\1/')
        TMPFILE=`/bin/mktemp -p .` || exit 1
        jpegtran [-grayscale] -copy none -optimize -perfect -trim -outfile $TMPFILE $1 && \
        touch $TMPFILE -r $1 && \
        /bin/mv $TMPFILE $1
        unset TMPFILE
        /bin/echo ... done. $(du -b $1 | sed 's/\([0-9]*\)\(.*\)/\1/')
        shift
    done

Resize JPEG images

for i in `ls "$1"`; do
    convert -size [1000]x900 [-quality n] $i conv_$i;
done

No comments: