This site requires JavaScript, please enable it in your browser!
Greenfoot back
frederikam
frederikam wrote ...

2013/11/26

How to read and compare a specific pixel in an img?

frederikam frederikam

2013/11/26

#
After Googling on the web I haven't really found an answer exactly what I need to do here. I want to be able to read an image, from which I will be able to draw a map out from. I need to be able to read the color of a specific pixel in a specific image, and depending on the color, return a simple integer. I don't need to use a specific image format. Thanks in advance.
bourne bourne

2013/11/26

#
Well say you are using GreenfootImage, use its getColorAt(int, int) to get a Color object which then can be examined using its methods such as equals, getRed, getGreen, getBlue, and getAlpha
frederikam frederikam

2013/11/27

#
Okay thanks for leading me in the right direction.
You need to login to post a reply.