Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Get Pixel Colors Of An Image

DZone's Guide to

Get Pixel Colors Of An Image

·
Free Resource
I wrote a hack to get the color of a pixel.
Now pys60 1.2 has support for getpixel (though undocumented).
Cyke64 has shown me in an example.

>>> from graphics import Image
>>> im = Image.new((10,10))   # create a new 10x10 image
>>> im.clear(0xff0000)        # make it all red
>>> im.getpixel((0,0))   # top-left is red
[(255, 0, 0)]
>>> im.getpixel([(0,0), (10,10)])  # you can get multiple points
[(255, 0, 0), (255, 0, 0)]
>>> 
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}