How to compress existing tiff files with lzw compression
January 16, 2007 9:01 PM   Subscribe

What UNIX command-line tool can I used to convert tiff files to lzw-compressed tiff files.

I have some 24bit color tiff files whose file size is "too large" for the project I'm working on. I need a command line (or PHP) tool that I can use to turn these uncompressed tiff files into compressed-via-lzw tiff files. I'm hoping for a 4x reduction in file size.

What say ye, MeFites?
posted by Wild_Eep to Computers & Internet (5 answers total) 1 user marked this as a favorite
Install LibTIFF and then use the following command line:

tiffcp -c lzw input.tif output.tif
posted by RichardP at 9:10 PM on January 16, 2007 [1 favorite]

libtiff (different link) and/or ImageMagick which will use libtiff and various other graphics libraries to convert from almost any format to almost any other format. Along the same line, there's also netpbm which will convert from anything to anything.
posted by zengargoyle at 10:58 PM on January 16, 2007

ImageMagick will do just about everything, just be aware that it has a reputation for being a huge pain to install.
posted by rsanheim at 6:43 AM on January 17, 2007

You can also use the netpbm tools to do this..

tifftopnm input.tif | pamtotiff -lzw > output.tif
posted by rajbot at 8:33 AM on January 17, 2007

Second zengargoyle on Imagemagick. It is the all-in-wonderful tool to do something like this. Amazingly, to convert these files, you would use 'convert':

convert -compress lzw source.tiff dest.tiff

To verify that things worked as expected (other than hopefully smaller files):

identify -verbose dest.tiff | grep Compression
posted by zeypher at 11:28 AM on January 17, 2007

« Older Looking for Mr. Goodwrench (sort of)   |   But I'm an atheist! Newer »
This thread is closed to new comments.