I am looking for a easy way to get the color value of a unknown colored pixel.
I know how I can set the pen color. But how can I get the color of a pixel on my drawing area? Using a sprite and test if there is a color toch is only possible if I knew all colors before. It have to work also with evenry background image oder own pictures.
Thanks for help.
Offline
I think the only way could be creating a sprite with these scripts:
[blocks]<when green flag clicked>
<forever>
<go to[ mouse-pointer
<if><mouse down?>
<if><touching color[ color
<set pen color to( color
<end>
<end>
[/blocks]
Sorry, but you'll have to know the pixel's colors. I think it's the only way to do it.
Offline
My problem is not the script. Mouse position is only one idea for a get-pixel-color-block. It's also usefull to copy a part of a picture like you can do it with the clone-tool.
there are 256 for Red, 256 for green and 256 possibilities for blue, that are 16.7 mio. colors. The Scratch interfaces is very slow if you try it with 32 [ if ... touching color ... ] blocks.
Is it possible to manipulate the [ touching color ] - color?
If I it is possible to set the [ touching color [ ] ? ] like the pen color ...
it would be possible to prof all colors.
Help? :-(
Offline
Hi xaby,
color value sensing is currently not possible in Scratch. It won't help much to iterate through the 200 possible color values in Scratch, because these can be combined with another 200 shade values and will ultimately *not* match every color which can be represented by 24 bits. If you're looking to 'copy' a part of the screen I' suggest using a very limited color set, maybe even black and white. There are some projects around demonstrating this you might want to look at:
http://scratch.mit.edu/projects/ericr/278951
http://scratch.mit.edu/projects/goch/85304
http://scratch.mit.edu/projects/Jens/63508
good luck!
Offline
Thanks for the links. How many different colors are possible with the touching sensor?
I think I have to re-engineer my idea. I hope I found enought colors for my program ;-)
Offline
Actually, the touching sensor should be able to detect *any* color which can be selected in its color palette. So it's not really a matter of how many different colors can possibly be detected, but how many you want your sprite to specifically look for
Offline
Okay, sounds good. I thought maybe the scratch-compression works against me. Thank's for answering.
Offline