Page 1 of 1

Image compressibility metric?

Posted: 2014-12-14T10:27:08-07:00
by konstantin
How can I get a measurement / metric of the compressibility of an image? I think it is related to the details, texture, and maybe number of colours on an image.

Re: Image compressibility metric?

Posted: 2014-12-14T10:51:22-07:00
by magick
See entropy from identify -verbose. It may only be available in the latest release, ImageMagick 6.9.0.

Re: Image compressibility metric?

Posted: 2014-12-14T13:18:35-07:00
by konstantin
Thx, compiling.
Is it possible to calculate only the entropy with the "identify" command? For speed reasons.

Re: Image compressibility metric?

Posted: 2014-12-14T13:53:12-07:00
by magick
You can get image entropy from the MagickCore API call GetImageEntropy(). From the command-line, entropy is only available with identify -verbose where it computes numerous other image statistics as well.

Re: Image compressibility metric?

Posted: 2014-12-14T14:22:55-07:00
by konstantin
Sad to hear, I never used an API. Is it possible to use it with Ruby?

Re: Image compressibility metric?

Posted: 2014-12-14T15:15:18-07:00
by fmw42
see string formats http://www.imagemagick.org/script/escape.php. It list [entropy]. This works for me

Code: Select all

convert rose: -format "%[entropy]" info:
0.89247

or

Code: Select all

identify -format "%[entropy]" rose:
0.89247

Compressability is probably format dependent. JPG has one form of compression, png has another and tiff has several optional forms.

Re: Image compressibility metric?

Posted: 2014-12-14T16:48:19-07:00
by snibgo
konstantin wrote:How can I get a measurement / metric of the compressibility of an image? I think it is related to the details, texture, and maybe number of colours on an image.
What does "compressibility" mean? One definition would be "the actual lossless compression that can be achieved". This would be the number of bits in the file, minus the overhead for headers etc, divided by the number of pixels.

Then you might consider a lossy compression that doesn't visibly change the image.

Re: Image compressibility metric?

Posted: 2014-12-14T17:36:33-07:00
by konstantin
Thx, it works, and quick enough.

Re: Image compressibility metric?

Posted: 2014-12-14T18:07:58-07:00
by konstantin
In fact I would mean the detailness or "business" of an image, but I assumed in the past that it is in connection with the compressibility, so I used the quality 2 jpeg file size as a metric for the image quality. Now I will try to use the entropy instead of.
snibgo wrote:
konstantin wrote:How can I get a measurement / metric of the compressibility of an image? I think it is related to the details, texture, and maybe number of colours on an image.
What does "compressibility" mean? One definition would be "the actual lossless compression that can be achieved". This would be the number of bits in the file, minus the overhead for headers etc, divided by the number of pixels.

Then you might consider a lossy compression that doesn't visibly change the image.