Badger 2040 rendering clean images without noise in image.py

Hi all, I’ve recently bought a badger 2040 and love it. After messing with different file formats and seemingly old tutorials on the badger image.py, here is what I’ve learned so far, so somebody else does not go crazy when trying to get a clean image without noise on the badger:

Pimoroni - Getting started with Badger 2040 (learn.pimoroni(dot)com/article/getting-started-with-badger-2040) and image.py state the image should be

  • size: 296 x 128 px
  • format: .jpg ( without progressive encoding, eventually turn off jpg-optimization )

Some confusion originates in a deprecated version of image.py (github(dot)com/pimoroni/pimoroni-pico/blob/main/micropython/examples/badger2040/image.py). Images were handled differently, as thoughtasylum (The Badger 2040: Custom Badges | ThoughtAsylum), Tonygo2 and LittleHobbyShop (forums.pimoroni(dot)com/t/badger-2040-image-conversion/19027) discussed a convert.py that generated .bin files and has been removed from the sources since then. The most recent image.py sources confirm this - no other filetype than .jpg is read.

Using Microsoft Paint to generate a .jpg with black/white pixels, worked best so far, however some noise pixels are added upon rendering. This seems odd as the current image.py source does use the default decode() and not the decodeDither() function that I suspected to be the root cause for the noise.

I’d prefer not to install GIMP just to generate a .jpg that is rendered cleanly, so do you have any advice for doing so?

KR,
Zlasha

@Zlasha I don’t suppose you came up with a solution for this? The noisy images are driving me mad.

JPG is not a lossless format. It will always have to generate pixel color-values and they will not match the original image. Even with Gimp, Photoshop et. al. you will notice that opening an image and then resaving it will result in an image that is different to the original image.

So what you see is not “noise”, but just plain jpg artefacts. What adds to the problem here is the very small image size. JPG is fine for large images (unless you zoom in to a 1:1 view). But even then, JPG has problems reproducing sharp edges. Text for example does not work well with JPG.

The only real solution to all of this is to use a different (lossless) image-format. Since image.py does not support this anymore, I would suggest that you downgrade to the version that had that support and go the way that others have discussed here on the forum.