All posts by pink

Reclaiming disk space from TIF files*

Okay. So it’s disk cleanup time. Over the years I’ve accumulated a fair amount of images, not all of them have been saved with compression – which vastly reduces their file size. When I say compression, I mean lossless compression. (think zip files)

In my case I’m looking at TIF and SGI files. Many time Flame operators forget to click the ‘compression’ button when they save out these formats due mostly to ignorance. What they don’t realize is that it’s loss-less compression. I digress.

So let’s reclaim disk space! Here is one stab at it using a bash script. Requires imagemagick. This will recursively descend from the current working directory.

*this code could be modified to deal with SGI’s, or targa (TGA) files. Make sure to check that convert’s -compress option is valid for those types!

#!/bin/bash

tifs=$(mktemp)
utifs=$(mktemp)
utifsizes=$(mktemp)

echo "Finding TIF files... (Please wait) > $tifs"
find . -iname "*.tif" -exec du {} \; > $tifs

echo -n "Disk usage of tif files "
awk 'BEGIN { sum = 0 } {sum = sum + $1} END {print sum " MB"}' $tifs

echo "Finding uncompressed TIF files... (Please wait) > $utifs"
cut -f2- $tifs | while read line ; do
identify -quiet -format "image-compression %C %d/%f" "$line" | grep None >> $utifs
done

echo -n "Number of uncompressed TIF files... "
count=$(wc -l $utifs | cut -d' ' -f1)
echo $count

if [ "$count" -ne "0" ] ; then

echo -n "Computing disk space used by uncompressed TIF files... > $utifsizes"
cut -f2- $tifs | while read line ; do
du -m "$line" >> $utifsizes
done
awk 'BEGIN { sum = 0 } {sum = sum + $1} END {print sum " MB"}' $utifsizes

echo "Compressing TIF files... (Please wait) "
cut -d' ' -f3- $utifs | while read line ; do
echo convert -compress lzw \""$line"\" \""$line"\"
convert -quiet -compress lzw "$line" "$line"
done

fi

Happy New Year

I know, I know… I give too little. If I made new year resolutions – well never mind. There has been considerable space-time since I last posted.

I started off my Summer biking to work at Hush over in DUMBO. Was the greatest [bike] commute of all my time. While on tour at Hush I was able to meet some great folks doing fantastic new media work. “Creative programming” is the future folks. Wish I could have spent more time there. Was only able to get my feet wet with this spot. Rented Houdini for the 3D. Composited in After Effects (which I didn’t do).

I did a little gig at Imaginary Lice… er, Forces which I won’t mention other than they don’t have enough good lunch spots around the facility. (Which is critical in choosing the facilities you want to freelance for in NYC).

For the last few months I’ve been locked up at The Framestore on a film titled, “The Secret Life of Walter Mitty”, due out next summer. Sorry no pictures yet.

As good as it’s been I have move on. In fact, I’m moving to Seattle, Washington! That’s right – and – *gasp* I’ll be working for Microsoft. All I can say about this is that I’m thrilled to be working with the team that brought you the Xbox Kinect.

“And if I’m the man, Then you’re the man, and
He’s the man as well…”