Due to high demand, expect some shipping delays at this time - orders may not ship for up to 2-3 business days.
0

Creating BMP files for CLUE
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Creating BMP files for CLUE

by DarTheMadScientist on Fri Apr 24, 2020 4:16 pm

I'm having trouble getting a BMP file to load. I think I have the right size. Maybe I have the wrong color depth.

I am doing this:

Code: Select all | TOGGLE FULL SIZE
# Add an image to the layer group
image, palette = adafruit_imageload.load("Covid Watch logo 240x240.bmp",
                                   bitmap=displayio.Bitmap,
                                   palette=displayio.Palette)

And what I get is this:

Code: Select all | TOGGLE FULL SIZE
Traceback (most recent call last):
  File "main.py", line 21, in <module>
  File "adafruit_imageload/__init__.py", line 61, in load
  File "adafruit_imageload/__init__.py", line 52, in load
  File "adafruit_imageload/bmp/__init__.py", line 62, in load
NotImplementedError: True color BMP unsupported

Do I need to change the color depth in the file? Any recommendations on tools that can do that?

Is there a better way to load the file and have a palette calculated for it?

DarTheMadScientist
 
Posts: 39
Joined: Mon May 07, 2018 7:47 pm

Re: Creating BMP files for CLUE

by kevinjwalters on Sun Apr 26, 2020 6:40 pm


kevinjwalters
 
Posts: 1011
Joined: Sun Oct 01, 2017 3:15 pm

Re: Creating BMP files for CLUE

by adafruit_support_carter on Mon Apr 27, 2020 6:55 pm

And here are some tips for using GIMP:
https://learn.adafruit.com/circuit-play ... sheets-5-1

The trick is to save the BMP as indexed.

adafruit_support_carter
 
Posts: 23520
Joined: Tue Nov 29, 2016 2:45 pm

Re: Creating BMP files for CLUE

by DarTheMadScientist on Mon Apr 27, 2020 7:56 pm

Thank you, both of you.

I'm on Mac, so I'm going to try ffmpg. Just downloaded it.

But I do have Windows on real and virtual machines, so that is a possibility.

Hmmm. Gimp. I don't have it. Yet. I will check out the tips.

DarTheMadScientist
 
Posts: 39
Joined: Mon May 07, 2018 7:47 pm

Re: Creating BMP files for CLUE

by adafruit_support_carter on Tue Apr 28, 2020 2:58 pm

GIMP is just the free Photoshop. If you have the later, it will also work.

adafruit_support_carter
 
Posts: 23520
Joined: Tue Nov 29, 2016 2:45 pm

Re: Creating BMP files for CLUE

by kevinjwalters on Tue Jun 09, 2020 10:40 am

I just noticed a surprise in GIMP for an external file. I loaded in a png image which was generated from MakeCode Arcade and converted that to an indexed format. I left the palette size at the default size of 255 knowing I only had four colours in there. On inspection, I found the colours varied a little around those four colours giving a larger palette - this may not be visually obvious. I left dithering set to None on the indexed converstion but I suspect this is some sort of dithering related to other colourspace conversions. I undid that and then reconverted with four colours and the bmp file is smaller now.

You can check the palette in GIMP for an indexed image with Windows > Dockable Dialogs > Colormap.

kevinjwalters
 
Posts: 1011
Joined: Sun Oct 01, 2017 3:15 pm

Re: Creating BMP files for CLUE

by kevinjwalters on Mon Jun 15, 2020 3:04 pm


kevinjwalters
 
Posts: 1011
Joined: Sun Oct 01, 2017 3:15 pm

Please be positive and constructive with your questions and comments.