Is it possible to find out what compression algorithms have been used for images in a PDF document?

  • If this includes paid-for software, use Acrobat Pro, which has an Object Inspector.
    – Jongware
    Nov 18 '15 at 21:25

You can use pdfimages -list $file on Unix/Linux systems, on Windows maybe you can install poppler to get access to the tool (see https://en.wikipedia.org/wiki/Pdfimages). Note that this is a command line application, without graphical user interface. Its output will look like

page   num  type   width height color comp bpc  enc interp  object ID x-ppi y-ppi size ratio
   1     0 image    1240  1753  gray    1   8  image  no         8  0   150   150  301K  14%
   2     1 image    1240  1753  gray    1   8  image  no        22  0   150   150  281K  13%
   3     2 image    1240  1753  gray    1   8  image  no        36  0   150   150  336K  16%

Where the enc column tells you the encoding algorithm, the possible values are listed in the manpage for pdfimages.

  • 1
    note xpdf web page seems to have windows and mac binaries
    – Yorik
    Nov 18 '15 at 22:24
  • btw, I was confused because the version of pdfimages I had, did not contain the "-list" option. turns out the project was forked back in 2011, so you are going to want pdfimages from Poppler, not Glyph & Cog's xpdf
    – cavalcade
    Sep 25 '16 at 0:57

Sort of.

If you open a PDF in a text editor, you'll find a line like this for each image:

<</Subtype/Image/Length 7986/Filter/FlateDecode/BitsPerComponent 8/ColorSpace 34 0 R/Width 368/Height 110/Type/XObject>>stream

This image uses the FlateDecode filter, "a commonly used filter based on the zlib/deflate algorithm (a.k.a. gzip, but not zip)"

<</Subtype/Image/Length 892/Filter/DCTDecode/BitsPerComponent 8/ColorSpace 34 0 R/Width 44/Height 23/Type/XObject>>stream

This image uses the DCTDecode filter, "a lossy filter based on the JPEG standard"

Filter definitions are from the Portable Document Format Wikipedia page, which has a list of all the supported filters.

However, it can be difficult to work out which image is which in a text editor - the objects do not necessarily occur in reading order. Breaking the PDF into single pages might help here.

I think Enfocus Pitstop Pro, an Acrobat plugin, may well give you this info (along with dimensions, position, DPI etc) in its object inspector, but I no longer have it, and can't seem to find any mention of this specific attribute in their manual.

  • 1
    Acrobat also has a myriad of predefined preflight reports. Not sure if they are available in the free version (?)
    – horatio
    Sep 4 '12 at 16:30
  • Note that PNG also uses the DEFLATE compression algorithm (zlib is an implementation of DEFLATE). So you can think of the first example as being like a PNG image in many respects such as how well it will compress. Sep 5 '12 at 0:30
  • @horatio: They are not. Also the free version is called "Adobe Reader" not "Adobe Acrobat Reader" these days.
    – e100
    Sep 5 '12 at 18:03
  • I thought it was Acrobat X or AcrobatZ or something :)
    – horatio
    Sep 5 '12 at 18:08
  • 1
    It's always been confusing. It's currently Adobe Reader X, Adobe Acrobat X, Adobe Acrobat X Pro. What really annoys me is when people refer to "Adobe" when they mean a single app.
    – e100
    Sep 5 '12 at 18:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.