pimoroni-pico
pimoroni-pico copied to clipboard
Issue with dithering on jpegdec
Hello,
While loading an image using jpegdec I'm getting a whole Buch of dots all over my image. I am using "DISPLAY_PICO_DISPLAY_2"with a custom buffer size: display_buffer = bytearray(110080) I'm using PEN_RGB332 for the colors but I don't see an option for removing dithering. I had it working well with PEN_RGB565 but due to memory constraints and the fact that I am no longer using a 320x240 screen, the buffer is now too small to use PEN_RGB565.
Hardware: Pimoroni Pico lipo Library: Pico Graphics Screen: Adafruit 1.47" 320x172 How do I show the full image without dithering? I am running Micro Python.
Code Snippet to load the JPEG: j = jpegdec.JPEG(LCD) # Open the JPEG file j.open_file("Capture.jpg") # Decode the JPEG j.decode(25, 60, 3) # Display the result LCD.update()
Here is what is available to me with jpegdec
I don't see dithering options

That was, uh, planned:
https://github.com/pimoroni/pimoroni-pico/blob/82756a3fc99dd587ef2b77d629748e713dd4074f/micropython/modules/jpegdec/jpegdec.cpp#L129
But yes RGB332 mode should support quantized output.
I do have another solution I had developed loading a RAW image type. But the solution is very slow and requires the file to be converted to a RAW format. I was just hoping that maybe I missed the option for dithering and would prefer to load the image directly without dithering. Also, I would like to use the baked in libraries as much as possible. Though the issue with speed is not really a problem for my current project since it is just a logo displayed on startup.
Should be fixed by #492
If you grab the appropriate build from https://github.com/pimoroni/pimoroni-pico/actions/runs/2839220919 and call decode like so: jpeg.decode(0, 0, dither=False) then it should posterise to the RGB332 colourspace instead.
Awesome, I tested it out and it is working as expected. thanks!