convert images

wilson wilson.t.thompson at gmail.com
Sun Apr 27 09:42:13 EDT 2008


hi
i converted some P5 type .pgm images to .jpg using
x=Image.open("oldimage.pgm")
imsz=x.size
newimg=Image.new('L',imsz)
newimg.putdata(x.getdata())
newimg.save("newimg.jpg")

when i again check the pixel data for these images using getdata()
method i,I find that they are slightly different

ie if oldimage.pgm has pixels
[29 31 38 ..., 10  4 18]
then the corresponding jpg image has
[29 31 38 ..., 10  3 17]

why this difference? shouldn't they be identical?can someone pls
explain this?




More information about the Python-list mailing list