Get Pixel Colors Of An Image
Join the DZone community and get the full member experience.Join For Free
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)] >>>
Opinions expressed by DZone contributors are their own.