Skip to content

plug-ins: bmp export - cleanup, compatibility

This is a draft for overhauling the BMP export plug-in, in preparation for adding support beyond 8-bits per channel.

It is mostly about making the logic flow more linear (the export plug-in had accumulated quite a few growth rings).

With regard to exporting certain bmps in the most compatible way, I added some constants and explanations at the top of bmp-export.c. They are not meant to stay there, it's just to easily show either what I'd recommend to change, or where it should be a conscious decision to keep the current behavior. (Setting them to the indicated 'GIMP < 3.0' values will produce exactly the same bmps as before).

The first commit is pretty big, as everything was so interwoven that I didn't see where to make a break.

(also fixes #12525)

EDIT: What I'd still like to do is:

  • don't gegl_buffer_get() the whole image at once (uses lots of RAM and fails for very large images), but load/write it in smaller chunks
  • RLE. Don't want to change anything about the algorithm (it's pretty neat and compact), but maybe some refactoring to make it easier to read. Getting it to where even I can understand it would be good :o) (EDIT: made some very small changes after all, but it remains mostly unchanged except for the name changes and comments)

EDIT: Extracted the actual pixel-writing code into separate functions per bmp-format (rgb/indexed/rle), along with some simplifications and additional preparation for writing higher-precision bmps.

Edited by Rupert Weber

Merge request reports

Loading