This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-11-21 07:57:46

siderits
Scratcher
Registered: 2009-04-26
Posts: 21

Query a pixel color on a canvas

Greetings all.
Is there a way to query the color of a pixel in a canvas image?
I'm working on some basic image analysis functions and need to quantify pixel colors in images.

Is this possible?

Thanks

Sid

Offline

 

#2 2009-11-21 09:55:30

cds56
Scratcher
Registered: 2008-05-02
Posts: 500+

Re: Query a pixel color on a canvas

You mean the
(touching color ____?) block?


http://img192.imageshack.us/img192/909/meowdevlogo.pnghttp://i32.tinypic.com/pucti.png

Offline

 

#3 2009-11-21 10:58:50

siderits
Scratcher
Registered: 2009-04-26
Posts: 21

Re: Query a pixel color on a canvas

I'd like to find out what color is at a given pixel on a background image, so I can reassign it.  For example, if I have an image of cells as my canvas, then what color pixel is at x=200 and y=150.

Is that possible?
Thanks
Sid

Offline

 

#4 2009-11-21 15:24:46

cds56
Scratcher
Registered: 2008-05-02
Posts: 500+

Re: Query a pixel color on a canvas

no, I don't think that's easily possible without a lot of scratch coding.


http://img192.imageshack.us/img192/909/meowdevlogo.pnghttp://i32.tinypic.com/pucti.png

Offline

 

#5 2009-11-22 07:59:57

jacool
Scratcher
Registered: 2008-01-25
Posts: 1000+

Re: Query a pixel color on a canvas

siderits wrote:

I'd like to find out what color is at a given pixel on a background image, so I can reassign it.  For example, if I have an image of cells as my canvas, then what color pixel is at x=200 and y=150.

Is that possible?
Thanks
Sid

You could have a one pixel sprite and use the <Go to _ x and _ y> block to set the coordinates.
And for the color sensing, the only way right now is to use the <if touching color _> block  hmm

This is my 1337th post  big_smile


http://i571.photobucket.com/albums/ss159/JacobKar/svensktiger-1.png

Offline

 

#6 2009-11-22 08:13:30

siderits
Scratcher
Registered: 2009-04-26
Posts: 21

Re: Query a pixel color on a canvas

Thanks for the feedback. 
I think that it would be useful for developing image analysis algorithms.
Best regards;
Sid

Offline

 

Board footer