I apologize I think I need to do more investigation, it looks like there is an actual hard limit at 65536 and going beyond it will cause some sort of banding artifact.
of course if it would be possible to fix the underlying issue and make it possible to process HUGE images, that would be fantastic.
But it looks like my proposal for just increasing the limit will not work.
Although we patch the limits, I must have accidently only tested with images that are still below the threshold.
Currently the
jpeg.Encode()
checks if the size of theimage.Image
passed to it is smaller than1<<16
in either dimension.We often work with images up to
1<<20
pixels wide.Our current solution is to patch the go source code before build to remove this check.
This solution works fine on amd64, I don't know if this restriction is mean to protect systems with lower memory or is just a sanity check.
Proposal: modify the line lined below to allow images as large as
1<<21
https://cs.opensource.google/go/go/+/refs/tags/go1.18:src/image/jpeg/writer.go;drc=35cbc3b55b9d5d159a5a7a160ea680b32f043bf8;l=577
The text was updated successfully, but these errors were encountered: