ImageMagick JPEG compression block size

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
pree
Posts: 3
Joined: 2013-04-11T10:03:36-07:00
Authentication code: 6789

ImageMagick JPEG compression block size

Post by pree »

Any idea on what block size (8x8 or 16x16 ??) is used in JPEG compression by ImageMagick? And, is there a way to change this default block size?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: ImageMagick JPEG compression block size

Post by fmw42 »

I do not know. The best reference I know is http://www.imagemagick.org/Usage/formats/#jpg_write
pree
Posts: 3
Joined: 2013-04-11T10:03:36-07:00
Authentication code: 6789

Re: ImageMagick JPEG compression block size

Post by pree »

fmw42 wrote:I do not know. The best reference I know is http://www.imagemagick.org/Usage/formats/#jpg_write
Yes, I already looked at it. In -sampling-factor option, it talks about the block size in addition to chroma sampling. However, I'm not able to relate them. I tried finding about it a lot and my best guess is when I say -sampling-factor 1x1, it takes the block size as 8x8. Similarly, for -sampling-factor 2x2, block size 16x16. May be it's like multiple of 8. Chroma sampling is not directly related to block size, however, it may have to do something in deciding the block size in ImageMagick jpeg compression algo. But it's not documented anywhere and hence not sure about it.
pree
Posts: 3
Joined: 2013-04-11T10:03:36-07:00
Authentication code: 6789

Re: ImageMagick JPEG compression block size

Post by pree »

I found this link: en.wikipedia.org/wiki/JPEG. It says "After subsampling, each channel must be split into 8×8 blocks. Depending on chroma subsampling, this yields (Minimum Coded Unit) MCU blocks of size 8×8 (4:4:4 – no subsampling), 16×8 (4:2:2), or most commonly 16×16 (4:2:0)."
Post Reply