Image compressibility metric?

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
konstantin
Posts: 50
Joined: 2013-08-07T13:50:31-07:00
Authentication code: 6789

Image compressibility metric?

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Image compressibility metric?

Post by magick »

See entropy from identify -verbose. It may only be available in the latest release, ImageMagick 6.9.0.
konstantin
Posts: 50
Joined: 2013-08-07T13:50:31-07:00
Authentication code: 6789

Re: Image compressibility metric?

Post by konstantin »

Thx, compiling.
Is it possible to calculate only the entropy with the "identify" command? For speed reasons.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Image compressibility metric?

Post 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.
konstantin
Posts: 50
Joined: 2013-08-07T13:50:31-07:00
Authentication code: 6789

Re: Image compressibility metric?

Post by konstantin »

Sad to hear, I never used an API. Is it possible to use it with Ruby?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Image compressibility metric?

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Image compressibility metric?

Post 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.
snibgo's IM pages: im.snibgo.com
konstantin
Posts: 50
Joined: 2013-08-07T13:50:31-07:00
Authentication code: 6789

Re: Image compressibility metric?

Post by konstantin »

Thx, it works, and quick enough.
konstantin
Posts: 50
Joined: 2013-08-07T13:50:31-07:00
Authentication code: 6789

Re: Image compressibility metric?

Post 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.
Post Reply