ValueError: Invalid file with OnDiskBitmap

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
CR34T0R
 
Posts: 24
Joined: Wed Aug 31, 2022 8:58 am

ValueError: Invalid file with OnDiskBitmap

Post by CR34T0R »

Hello, I'm trying to display icons such as these on an e-ink display.

When I display the display-ruler.bmp from the example provided in the tutorial it works great, but when I try to use any image that I convert using this

Code: Select all

convert humidity.png -dither FloydSteinberg -define dither:diffusion-amount=85% -remap eink-2color.png BMP3:output.bmp
(Tried attaching the files but can't upload the bmp files.)

I always get:
ValueError: Invalid file
I tried using different conversion tools also, and several filetypes and resizing, I have no idea what else to try, help appreciated, thanks!

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: ValueError: Invalid file with OnDiskBitmap

Post by mikeysklar »

Which model of e-ink display are you using?

User avatar
tannewt
 
Posts: 3298
Joined: Thu Oct 06, 2016 8:48 pm

Re: ValueError: Invalid file with OnDiskBitmap

Post by tannewt »

I think you can attach the bmp files by putting them in a zip. I usually use the GIMP to save bmp files like the display ruler. Make sure they do not use run length encoding (RLE) or any other compression. You can use indexed colors though.

User avatar
CR34T0R
 
Posts: 24
Joined: Wed Aug 31, 2022 8:58 am

Re: ValueError: Invalid file with OnDiskBitmap

Post by CR34T0R »

mikeysklar wrote: Mon Jan 30, 2023 1:55 pm Which model of e-ink display are you using?
This
tannewt wrote: Mon Jan 30, 2023 4:52 pm I think you can attach the bmp files by putting them in a zip. I usually use the GIMP to save bmp files like the display ruler. Make sure they do not use run length encoding (RLE) or any other compression. You can use indexed colors though.
Here are the 2 files I used and 2 of the outputs in bmp I got using the mentioned in the original post.

Thank you both for your time :)
Attachments
Archive.zip
(30.89 KiB) Downloaded 3 times

User avatar
tannewt
 
Posts: 3298
Joined: Thu Oct 06, 2016 8:48 pm

Re: ValueError: Invalid file with OnDiskBitmap

Post by tannewt »

The thermometer.bmp worked for me. *However,* I did get the Invalid file error once. It happened when the whole file hadn't been written yet. Its a bit big so you'll want to make sure your OS is done writing the file before running the code. (Try just running it again after the error.)

User avatar
CR34T0R
 
Posts: 24
Joined: Wed Aug 31, 2022 8:58 am

Re: ValueError: Invalid file with OnDiskBitmap

Post by CR34T0R »

tannewt wrote: Tue Jan 31, 2023 3:11 pm The thermometer.bmp worked for me. *However,* I did get the Invalid file error once. It happened when the whole file hadn't been written yet. Its a bit big so you'll want to make sure your OS is done writing the file before running the code. (Try just running it again after the error.)

Oh, that was it, but I believe the file was corrupted or something because I tried several times and changed the code many times in between tests, but on a fresh flash with the same code as the other day it's working perfectly, thanks.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”