2

JPEG/JFIF supports a maximum image size of 65535×65535 pixels. Is there any reason why ImageMagick's montage limit the JPG output to 65500 instead of 65535?

enter image description here

1
  • 1
    This is a funny choice seeing how the DCT operates on 8x8 blocks and 65500 doesn't divide by 8 evenly. 65504 would have been a much better choice.
    – Damon
    Dec 7, 2019 at 18:57

1 Answer 1

7

ImageMagick uses libjpeg-turbo (http://sourceforge.net/projects/libjpeg-turbo) and the maximum dimensions are defined in the file jmorecfg.h. I could not find a good source why this value was chosen but according to the comment it was chosen to prevent an overflow.

#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .