Looking for a way to be able to find the color data of a pixel(s) on a Canvas. I'm sort of a beginner to coding, just gauging if this is possible/how to go about this. This is for a project I've been working on, and for part of it, it's necessary to compare the color data of a Canvas to an Image. I know how to find the per pixel color data of an Image, but I haven't found anything for a canvas. I'm using a Tkinter Canvas at the moment, but if it's not possible on that library, I'm open to switching to another library. Any ideas? Thanks guys!
Asked
Active
Viewed 319 times
0
-
1canvas doesn't have this function - some solution is to use `pillow` and draw on `pillow.Image` (which is bitmap) and it gives access to pixels. And display `pillow.Image` on Canvas. – furas May 17 '22 at 00:13
-
other GUIs (like `PyQt`, `PyGTK`, `wxPython`) may give access to pixels but first it may need longer code to get access to they `Canvas` - and finally it can be simpler to draw on Image in this GUI and display this image on Canvas. – furas May 17 '22 at 00:17
-
You can use `Pillow.ImageGrab()` to take a screen shot on the point and then get the color from the one-pixel screen shot. See my answer to this [question](https://stackoverflow.com/a/61292863/5317403). – acw1668 May 17 '22 at 09:36
1 Answers
0
Looking for a way to be able to find the color data of a pixel(s) on a Canvas.
Tkinter doesn't provide the ability to do this.

Bryan Oakley
- 370,779
- 53
- 539
- 685
-
Gotcha. I did a bit more research and I think a bitmap is the way to go for my specific project. Thanks for the help! – Sean Webb May 16 '22 at 23:54