waveshareteam / Pico_ePaper_Code

Waveshrae Pico e-Paper driver code
GNU General Public License v3.0
124 stars 44 forks source link

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

Open miraclehoshi opened 1 year ago

miraclehoshi commented 1 year ago

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

anglerfish27 commented 1 year ago

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 commented 1 year ago

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 commented 4 months ago

You can find pbm tutorial here