« IE Freezes Up Downloading Images | Main | Afternoon in Boston Harbor »

September 26, 2003

Bulk jpegtran Update Script (with an XML check)

Thought I'd post the command I used to do the jpeg cleanup solving yesterday's problem:

for id in `find . -exec grep "<plist version" {} \; | awk -F. '{print $2}' | sed -e "s/\///"`; do jpegtran -copy none $id.jpg > $id-2.jpg; mv $id-2.jpg $id.jpg; echo $id" done"; done
The gist is to grep each image for the offending XML, and if it exists run it through jpegtran to remove the offending extra junk, saving the new image. Then move the new image over the original. Works like a charm (provided you're are in the directory with the images). My images are named 1.jpg, 2.jpg etc.

UPDATE: I discovered that a handful of images on this weblog had the problem, those have been fixed as well.

Posted by mike at September 26, 2003 8:36 AM