Satya's blog - Smaller JPEGs

Dec 05 2004 12:29 Smaller JPEGs
Found out about this from someone's blog. It seems that JPEG files can have application blocks, which are extra information about the file. These are useful for photo editing and cataloging applications but add nothing to the image. Removing these blocks makes no difference to the displayed image.

Since my albums are produced from a source archive, I can remove the blocks from the processed album (leaving the sources as they were) and get a significant saving in file sizes. How significant? The albums/ directory went from about 68MiB to about 52MiB after doing this: for i in `find . -name "*.jpg" -print`; do convert +profile "*" t.jpg;mv t.jpg $r;done

(I had to escape the quote marks because I redirected the output of this command, after adding echos, to a file and ran the file. Be careful if your filenames have spaces or non-lowercase .jpg extensions.)