tags:

views:

13

answers:

1

i am using putpixel operation on image (srcImage) which is w = 134 and h = 454

The code here gets r,g,b value of part of the font which is 0,255,0 which i found through debugging (using print option).

image = letters['H']  
r,g,b = image.getpixel((1,1))    *Note r g b values are 0, 255,0*  
srcImage.putpixel((10,15),(r,g,b))   
srcImage.save('lolmini2.jpg')

This code is not giving any error but when i look at the saved image i cannot spot the pure green pixel.

+1  A: 

Instead of using putpixel() and getpixel() you should use indexing instead. For getpixel() you can use pixesl[1, 1] and for putpixel you can use pixels[1, 1] = (r, g, b). It should work the same but it's much faster. pixels here is image.load()

However, I don't see why it wouldn't work. It should work without a problem. Perhaps the jpeg compression is killing you here. Have you tried saving it as a png/gif file instead? Or setting more than 1 pixel.

WoLpH
Agreed. The jpeg compression would almost certainly wash out the pixel. PNG is your friend.
Blair Conrad