tk - canvas accessing color for each pixel

E

Ed Redman

I would like to access and change the color of any pixel on a Tk/canvas.
I want to be able to scan the canvas and if the color at a certain point
is lets say 'red' then make it 'green". I don't see a point widget for
tkcanvas. Can I do this?

thanks
Ed Redman
(e-mail address removed)
 
H

Hidetoshi NAGAI

From: Ed Redman <[email protected]>
Subject: tk - canvas accessing color for each pixel
Date: Tue, 18 Oct 2005 21:41:57 +0900
Message-ID: said:
I would like to access and change the color of any pixel on a Tk/canvas.

A canvas widget doesn't support to access per pixel.
Although you can do that if each pixel is represented by a line item,
that will be incredibly slow.

If you want to do that, I think, you'll have to use a PhotoImage object.
On a PhotoImage, you can access and change the color of any pixel.
Please use TkPhotoImage#get and TkPhotoImage#put.
And please read "photo" manual of Tcl/Tk.

Stadard Tcl/Tk libraries supports only GIF and PPM/PGM.
If you want to treat other image formats,
please use "Img" extesion of Tcl/Tk.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top