GIF plugin crashes when saving very large images
I do have an image, that is about 57000 x 60000 pixels. I do save it as PNG usually (8-bit per color with RGB, aka 3 bytes per pixel), or after switching to Indexed mode as PNG with colormap (8-bit per pixel, 1 byte per pixel, before compression) to save on some space and time to save. But I was wondering about GIF and I did test it (GIF has for example 6-bit per pixel, which could be useful for me). Still testing 255 colors indexed mode, I tried saving as GIF, the option dialog show up (I leave the defaults, with comment on, and interlacing disabled), I click Export, then it does crash just after 1 or 2 seconds. It does leave a file on disk that has 802 bytes.
GIMP do show a crash dialog:
Plug-in crashed: "file-gif-save"
(/usr/lib/gimp/2.0/plug-ins/file-gif-save/file-gif-save)
No stack trace or anything.
Linux, Debian/GNU Linux testing, amd64 , GIMP 2.10.12-1 and GIMP 2.10.14 tested.
Reproducing should be easy:
- Create empty image that is reasonably large. 60000x60000 pixels, 8-bit integer, (approx 10.06GiB of 24-bit of pixel data, shows as 16.4GB by GIMP initially, with just white background) using "File -> New ...". Using grayscale is also fine (1 byte per pixel), it will also crash, but less memory (about 5.2GB by GIMP internally) compared to color (RGB) image.
- Convert to indexed mode (to speed things up use "Web optimized pallet, so pallet determination is skipped) using "Image -> Mode -> Indexed ..."
- Export as GIF using "File -> Export As ..."