PIL JPEG pixel problem

Mark itcram at yahoo.com
Tue Jan 7 12:46:13 EST 2003


I'm having problems changing the pixels in a .jpg file.

>>>import Image
>>> x = Image.open('te.jpg')
>>> x.getpixel((0,0))
(255, 255, 255)
>>> x.putpixel((0,0),(100,150,165))
>>> x.save('asdf.jpg')
>>>
>>> x = Image.open('asdf.jpg')
>>> x.getpixel((0,0))
(146, 146, 146)

When I open it up after changing the pixels they are I get totally
different pixels from (100,150,165) to (146,146,146).  I've tried
using the different options in the save() method(not all possible
combonations), but they always are different.  Does anyone know how I
can fix this?

Thanks!




More information about the Python-list mailing list