# Badger 2040 rendering clean images without noise in image.py

**URL:** <https://forums.pimoroni.com/t/badger-2040-rendering-clean-images-without-noise-in-image-py/22418>\
**Category:** Support\
**Created:** [June 29, 2023, 9:52am UTC](https://forums.pimoroni.com/t/badger-2040-rendering-clean-images-without-noise-in-image-py/22418 "2023-06-29T09:52:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zlasha](https://avatars.discourse-cdn.com/v4/letter/z/54ee81/32.png) [@Zlasha](https://forums.pimoroni.com/u/Zlasha)\
**Post date:** [June 29, 2023, 9:52am UTC](https://forums.pimoroni.com/t/badger-2040-rendering-clean-images-without-noise-in-image-py/22418/1 "2023-06-29T09:52:44Z")

</div>

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](https://www.thoughtasylum.com/2022/05/01/the-badger-2040-custom-badges/)), 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

---

<div class="post-metadata">

**Author:** ![BigAlUK](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@BigAlUK](https://forums.pimoroni.com/u/BigAlUK)\
**Post date:** [December 15, 2023, 3:47pm UTC](https://forums.pimoroni.com/t/badger-2040-rendering-clean-images-without-noise-in-image-py/22418/2 "2023-12-15T15:47:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bablokb](https://avatars.discourse-cdn.com/v4/letter/b/ee59a6/32.png) [@bablokb](https://forums.pimoroni.com/u/bablokb)\
**Post date:** [December 16, 2023, 8:10am UTC](https://forums.pimoroni.com/t/badger-2040-rendering-clean-images-without-noise-in-image-py/22418/3 "2023-12-16T08:10:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sseebbiin](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@sseebbiin](https://forums.pimoroni.com/u/sseebbiin)\
**Post date:** [August 3, 2025, 2:49pm UTC](https://forums.pimoroni.com/t/badger-2040-rendering-clean-images-without-noise-in-image-py/22418/4 "2025-08-03T14:49:39Z")

</div>

The solution I’ve went with for things like icons is to simply use PNG files. With PNG the artifacts are gone from the test images I created. File sizes are also smaller.

---

<div class="post-metadata">

**Author:** ![bablokb](https://avatars.discourse-cdn.com/v4/letter/b/ee59a6/32.png) [@bablokb](https://forums.pimoroni.com/u/bablokb)\
**Post date:** [August 4, 2025, 7:22am UTC](https://forums.pimoroni.com/t/badger-2040-rendering-clean-images-without-noise-in-image-py/22418/5 "2025-08-04T07:22:13Z")

</div>

Yea, exactly what I recommended. PNG is a lossless image-format. For normal images PNG is larger though, but for reduced color images (e.g. icons) file sizes might be smaller.
