GNOME Bugzilla – Bug 705889
BMP plug-in - no support for 'do not write color space information' in script-fu
Last modified: 2018-05-24 13:49:36 UTC
Can't find an equivalent for 'do not write color space information' in script-fu? 'file-bmp-save' does not seem to have this option, but googling around a little it seems that this is a very much needed option for others as well because my script now creates bmp's not compatible with some programs...
Shouldn't be that hard to add this to the BMP plug-in. Do you want to give it a try? But note that the current procedure must stay as it is for compatibility, you'll have to introduce a new one. See e.g. the PNG plug-in, which registers file-png-save2 to add new parameters because of the same requirement.
Adding a new callable procedure in the BMP plug-in is the best way to fix this. Changing Component to Plug-ins.
Created attachment 354320 [details] [review] Adds script-fu save command to let users not write color space info (also adds the other two BMP save options) This patch adds a new script-fu procedure, file-bmp-save2, which allows non-interactive control of whether the color space is written or not. It also adds the other two BMP save options, whether to use Run-Length Encoding and what RGB Format to save the pixels in. Edits the following files in plug-ins/file-bmp/: bmp.h bmp.c bmp-save.h bmp-save.c Two notes: 1) BMPs only have Run-Length encoding for 4bpp or 8bpp images (RLE4 & RLE8). If you set the 'use-rle' flag in file-bmp-save2 on any other type of BMP, GIMP's current write_image() function ignores it and produces a valid (but uncompressed) image. I'm unsure if that's acceptable behavior, or if the script-fu should throw a warning or an error. 2) The 'rgb-format' value is an enum type called "RGBMode". Since I couldn't use that as a datatype for the script-fu, I ask for an integer in the command. That's then used as an index to cast the appropriate value from the RGBMode enum. This works because the enum has no defined values, so you can access them in default order [(RGBMode) 0 casts to 'RGB_565', (RGBMode) 1 casts to 'RGBA_5551', etc]. If the RGBMode enum was ever initialized to have values (E.g. RGBA_5551 = 10;), the casting would break and would have to be re-written at that time. I'm not sure if those two notes are issues or not - if they are, I'm happy to update the patch as needed.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gimp/issues/491.