Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I several TIFF images in a folder. How can I determine which image compression algorithm they use?

When I do file I get

100 (2).tif:                 TIFF image data, little-endian
100.tif:                     TIFF image data, little-endian

These results don't say which algorithm is used, or even whether it's lossy or lossless. How can I figure this out? Solutions can be Windows- or Linux-based.

share|improve this question

migrated from stackoverflow.com Mar 20 '12 at 14:05

This question came from our site for professional and enthusiast programmers.

1  
Looking at the image's extension should be enough. – Icarus Mar 20 '12 at 13:52
    
isn't the extension a sufficient information? else, file gives you the basic infos on a file (linux/macosx) – njzk2 Mar 20 '12 at 13:52
1  
Most compression algorithms include a header with a fixed tag of some form. It wouldn't be too much of a challenge to roll your own identifier. – adelphus Mar 20 '12 at 13:53
up vote 5 down vote accepted

Use W_Whalley's identify -verbose suggestion instead. If you're in a linux/cygwin environment, pipe it to grep -i compression and you'll have your one-line answer. I.e.

identify -verbose /path/to/your/file.tiff | grep -i compression

share|improve this answer

If you have imagemagick installed, use the display tool to show the image. Right-click on the image and choose Image Info, then look for the Compression: setting (it's near the bottom of the list). Or if you want the minimum information use the identify tool with the -verbose switch, then filter the result to look for the Compression line.

share|improve this answer

What about the file command? Example:

$ file /usr/share/apache2/icons/a.png
/usr/share/apache2/icons/a.png: PNG image, 20 x 22, 4-bit colormap, non-interlaced
share|improve this answer
    
But where is the name of the algorithm used ? – klijo Mar 20 '12 at 14:49
    
PNG is a compression algorithm (a lossless one). Image file formats are typically named after thier compression algorithm. The term "JPEG" for example, doesn't technically refer to a file type; it refers to a compression scheme. Colloquially the two are pretty universally conflated, but the type of image (TIFF, PNG, etc.) usually (but not always) refers to the compression algorithm used. – Zac B Mar 20 '12 at 15:04
    
TIFF can be made to work with both lossless and lossy compression. This is my real problem. I need to determine which of them uses lossy and which uses lossless and the name of the algorithm – klijo Mar 20 '12 at 15:14
    
Sorry, TIFF was a bad example. The TIFF format usually uses LZW, but there are (rare, but present) implementations of it that use other algorithms as well. – Zac B Mar 20 '12 at 15:16
1  
Use W_Whalley's identify -verbose suggestion instead. If you're in a linux/cygwin environment, pipe it to grep compression and you'll have your one-line answer. – Zac B Mar 20 '12 at 17:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .