Decompressing and Renaming Tiff images

| | Comments (0) | TrackBacks (0)

I've been messing around with OCR for a possible new project. To train Tesseract, I had to decompress and rename a bunch of .tif files. Rather than deal with Photoshop, I decided to hack a little bash script using tiffcp. This also gave me a chance to play with the regex powers of Bash.

#!/bin/bash
for fname in *.g4.tif
do
if [[ $fname =~ (.*)\.g4\.tif ]]
then
tiffcp -c none $fname ${BASH_REMATCH[1]}'.tif'
else
echo "foo"
fi
done

Categories

,

0 TrackBacks

Listed below are links to blogs that reference this entry: Decompressing and Renaming Tiff images.

TrackBack URL for this entry: http://hyperradiant.net/MT-4/mt-tb.cgi/232

Leave a comment

About this Entry

This page contains a single entry by Alex published on October 5, 2008 6:18 PM

Map function in JavaScript was the previous entry in this blog.

Not all hacking is computer-centric. is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.