2
1
Is there a unix command to check the level of compression or the compression ratio for an image (png,jpeg,gif)? The mac based mdls command displayed a lot of metadata information, but didn't mention anything about compression
2
1
Is there a unix command to check the level of compression or the compression ratio for an image (png,jpeg,gif)? The mac based mdls command displayed a lot of metadata information, but didn't mention anything about compression
1
identify -verbose
from imagemagick/graphicsmagick will tell you the image dimensions, number of channels and number of bits per channel.
From this you can derive how many bytes of memory the uncompressed image would take.
From this and the file size, you can determine how many bits-per-pixel it is compressing to.
Will: For a 1KB(1024 X 8 bits) image with a pixel count of 1890, the bits-per-pixel is "4.33". Is 4.33 the level of compression for this image? Is bits-per-pixel the indicator of compression? – smokinguns – 2012-04-16T18:00:52.657
@smokinguns: essentially "yes". a picture with WIDTHxHEIGHT pixels translates directly into MEMORYSIZE (WIDTH x HEIGHT x NUMBER_OF_CHANNELS x BITS_PER_CHANNEL). then look at the FILESIZE. COMPRESSION_RATIO = FILESIZE / MEMORYSIZE. a usual bits-per-pixel value is 24 or 32 (for RGB or RGBA pixels). – akira – 2012-04-17T09:01:52.063
isn't compression ratio the the size of the compressed file compared to that of the uncompressed file? I'm confused how bits-per-pixels can be an indicator of compression level. – smokinguns – 2012-04-17T17:19:13.473