[SOLVED] fully specifying the png compression method

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

[SOLVED] fully specifying the png compression method

Post by NicolasRobidoux »

If I understand correctly, the png compression system is defined by 3 numbers.
For example, here is some pngcrush output:

Code: Select all

  Total length of data found in IDAT chunks    =   348784
unknown chunk handling done.
   IDAT length with method   1 (fm 0 zl 4 zs 0) =   223599
   IDAT length with method   2 (fm 1 zl 4 zs 0) =   248123
   IDAT length with method   3 (fm 5 zl 4 zs 1) =   385096
   IDAT length with method   4 (fm 0 zl 9 zs 1) =   323957
   IDAT length with method   7 (fm 0 zl 9 zs 0) =   212899
   Best pngcrush method = 7 (fm 0 zl 9 zs 0) for temp.png
Now, "fm 0 zl 9" corresponds to "-quality 90" (they are in the opposite order) in ImageMagick.
Is there a way of setting zs as well?
Last edited by NicolasRobidoux on 2012-10-05T16:14:02-07:00, edited 1 time in total.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: fully specifying the png compression method

Post by glennrp »

Yes. Instead of -quality, use
  • -define png:compression-strategy=zs
    -define png:compression-level=zl
    -define png:compression-filter=fm
for complete control over the compression
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: fully specifying the png compression method

Post by NicolasRobidoux »

Thank you Glenn.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: [SOLVED] fully specifying the png compression method

Post by anthony »

Added to IM Examples, Formats, PNG, Writing Controls
http://www.imagemagick.org/Usage/formats/#png_write
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply