Skip to content

plug-ins: bmp import - overhaul

Rupert Weber requested to merge r.weberhenschel/gimp-rwh:rwh-bmpimport into master

NOTE: Do not merge before gimp-test-images!2 has been merged, or CI will break!

This has now become a complete overhaul of the bmp import plugin, comprising:

  • fix #5434 (closed) (dimension checks/limits)
  • make bmp import losless (#12266 (closed)) import as 8/16/32-bit int or as float, as needed
  • add support for 2-bit and ALPHABITFIELDS bmps
  • clean up header parsing
    • be more lenient with regards to file header specs
    • correctly identify OS/2 Huffman encoding
  • add RLE24 compression support
  • add Huffman compression support
  • load bmp chunk-wise instead of whole image at once (to reduce memory consumption)
  • RLE compression: make undefined pixels transparent by adding alpha channel

Original MR description:

Fixes (#5434 (closed)), unnecessarily restrictive dimension checks in bmp import plug-in, plus some minor cleanups. The plug-in will now allow any size it can handle and that GIMP allows, making sure to avoid integer overruns.

I originally had an additional arbitrary limit (4GB) on the total needed memory allocation, but have removed it because I think in the end it's a bad idea to have import plug-ins put an artificial limit on the image size (and there is really no one good value that would fit all use cases).

Also included some minor cleanup: unneeded old debug messages, and checking return value of file io functions (also avoids compiler warnings)

Edited by Rupert Weber

Merge request reports

Loading