pimoroni-pico
pimoroni-pico copied to clipboard
Colour of a pixel at (x, y)
https://mpython.readthedocs.io/en/master/library/micropython/framebuf.html
FrameBuffer. pixel (x, y [, c ])
_If C is not given, the color value of the specified pixel is obtained. If C is given, the specified pixel is set to the given color.
This does what you want to do. It gives the colour at the specified point._
Unfortunately, Pico Graphics have not (yet?) provided this facility. It would be very useful. Could it be added, please. See: https://forums.pimoroni.com/t/can-you-access-framebuffer-in-pimoroni-picographics-micropython-w/21056/26
Happy new year
PicoGraphics has pretty arbitrary colour formats - including palette and reduced colour modes with automatic quantization and dithering - which would make reading back a colour produce unexpected results more often than not. It's probably something we want to include anyway, for when it works, but it needs some thought since it has the potential to be very, very confusing.
Thanks for getting back to me. We have found a work around , for the moment, which has been added to the original Forum thread.
Regards Tony > On 09/01/2023 16:07 Philip Howard @.***> wrote:
PicoGraphics has pretty arbitrary colour formats - including palette and reduced colour modes with automatic quantization and dithering - which would make reading back a colour produce unexpected results more often than not. It's probably something we want to include anyway, for when it works, but it needs some thought since it has the potential to be very, very confusing.
— Reply to this email directly, view it on GitHub https://github.com/pimoroni/pimoroni-pico/issues/620#issuecomment-1375870234, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3K7VLMMXP2PC3JAGAFUL3WRQZTHANCNFSM6AAAAAATRYRA4U. You are receiving this because you authored the thread. https://github.com/notifications/beacon/AA3K7VJJ7ISUPBI5EWO2PQLWRQZTHA5CNFSM6AAAAAATRYRA4WWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSSAIORU.gifMessage ID: @.***>
Somewhat relatedly, a get_palette() would also be useful---if picking pixels from a P8 buffer gives you indexes, which is what I'd expect, you'd need that to map it to RGB. (It'd also be useful to do palette-cycling without having to hold a second copy of it.)