#Indexed bitmaps BMPs and GIMP
1 messages · Page 1 of 1 (latest)
Linked from here: https://circuitpython.readthedocs.io/projects/imageload/en/latest/
Talking specifically about this dialog window.
Are there any cases where checking those will impact displayio?
I am going to guess it might have to do with the color space info? Perhaps?
This illustrates my experimentation with those settings... a 38 kB BMP goes down to 6.2 kB.
That's pretty significant.
@royal zinc since you wrote the article I am pointing at you. With love.
It's a good question. I am not actually sure. I don't think I have ever changed the defaults. That does sound like a great savings though so definitely worth some looking into! The two main things that can be done with bitmaps in DisplayIO are use imageload like you linked to load it (especially necessary if it's a spritesheet or similar asset). And OnDiskBitmap: https://circuitpython.readthedocs.io/en/latest/shared-bindings/displayio/index.html#displayio.OnDiskBitmap As long as those two things still work the same for an image saved with those options then I think they should be fine to use.
Good point. I'll make sure I test OnDiskBitmap as well.
I am curious if it has any impact on load times? I'll do some benchmarks on my RP2040 to see if the smaller image maybe decodes slower? Or, if it's just that the color space information takes up 3-4x the image size itself, providing you use both run-length encoded and not writing color space information. I mean, the bitmap's already indexed, so would I even need color space info?! However, it must be combined with run-length encoding.
I'm not sure what the "color space information" is in this context. Loading the BMP in Circuitpython code ends up returning the Palette object loaded with colors. So if that comes from the "color space information" inside the file then I do think it'll be needed in most cases.
I don't think color space information is the palette, though, because my images retain all their defined, indexed, colors. I think the color space crap is just like an RGB color profile or similar?
Some insight on BMPs:
Indexed color images may be compressed with 4-bit or 8-bit RLE or Huffman 1D algorithm.
It looks like GIMP only supports RLE (Run-Length Encoding).
Also, see here:
https://en.wikipedia.org/wiki/BMP_file_format#Pixel_format
The BMP file format, also known as bitmap image file, device independent bitmap (DIB) file format and bitmap, is a raster graphics image file format used to store bitmap digital images, independently of the display device (such as a graphics adapter), especially on Microsoft Windows and OS/2 operating systems.
The BMP file format is capable of s...
What's kind of confusing, though, is that if you leave the color space information, no compression happens, essentially. Unless you check both of them in the GIMP export screen, you still end up with 30 kB versus 6 kB or whatever.
Likewise, stripping just the color space info doesn't make the image smaller.
Interesting that they are tied together like that. Seems like a great amount of savings though, I'm surprised that it's able to lose that much information and still render fine, but that is awesome. We should update the page in the TileMap game guide, and maybe add some of this information into the docs for the ImageLoad library.