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


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 */

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.