Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An example code of displaying an bitmap image using micropython does not exist. #18

Open
miraclehoshi opened this issue Aug 2, 2022 · 3 comments

Comments

@miraclehoshi
Copy link

Yes.. my level of knowledge doesn't know how to display bitmaps. Can you please update this?

@anglerfish27
Copy link

anglerfish27 commented Nov 27, 2022

There several ways to go about this, at least in C, which some probably can be ported to MP.

You can convert images into a hex array as a .h or .c file and call those by name. The good thing about these is since you are reading from compiled files you don't lose your RAM space which depending on the size of the screen and if it has colors, you can run out of space in the frame buffer, especially in MP because you have to load the MP u2f firmware which eats some of the precious memory. I usually do the above but again that's for C/C++. I'm sure there's got to be something similar in MP. For example my girlfriend wanted the Pimoroni Tufty2040 which has 65K (RGB 565) support. Well I quickly found out one image at 565RBG would crash the Pico because MP had eaten up on the RAM. Fortunately I found a way around with with some clever people. I converted the image into raw code with a little help from GIMP or Photoshop and a custom python program I found on the web that did the conversion. I was left with a .bin image file. I copied that over using Thonny and I was able to load as many pictures as I could store on the Tufty (it has 8MB of non RAM storage and each image in raw conversion was about 150Kb. This was for a ST7789 graphics driver. I don't know MP at all but I stumbled through just enough to get the Tufty2040 working at RGB565 (65K colors) in MP. The Tufty2040 C++ code was a hot mess so I figured MP was best. Email Waveshare support directly. They are AWESOME in helping out. I bug them all the time lol they probably know me by name. I also spend money in return! They are slow to respond but they always help out in one way or another.

@ingelumer
Copy link

I also would highly appreciate sample MicroPython code how to show simple images (eg pbm files / bytearrays).
The sample code works fine with text, lines and boxes, but really the images are missing to make the displays useful.

@trybula
Copy link

trybula commented Feb 19, 2024

You can find pbm tutorial here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants