[Tutor] [tutor] Pil image related question -- resending messagewithout attachments

Tiger12506 keridee at jayco.net
Mon Jan 7 22:50:48 CET 2008


I assume you realize that jpeg is a lossy format and that consecutively
resizing the same image will no doubt end poorly in image quality.

Also, I assume that you have a better understanding of the NEAREST and
BICUBIC options than I do because you are apparently comparing them. I do
know that those will affect your image quality.

I do not doubt that somewhere in the documentation for PIL (it can be an old
copy) that it will tell you how to set the compression level for jpeg
images, particularly when you save them back, possibly a default
parameter(?).

Kinda shooting in the dark.

> Hello All,
>      I am actually working on a project which deals with image processing.
> I just used pil function to resize the image into the dimensions i want. i
> was able to resize the image but the clarity of the new image is not good.
> Can anyone suggest which other functions i should use to improve the
> clarity. I am attaching the code and sending the images in the attachment.
> Can anyone suggest me how to do it ?
>
> import Image
>
> imageFile = "srk.jpg" #original small image
>
> im1 = Image.open(imageFile)
>
> width = 680
> height = 420
>
> im2 = im1.resize((width,height), Image.NEAREST)
> im3 = im1.resize ((width,height), Image.BICUBIC)
>
> #images get saved in c drive with jpg extensions
> ext = ".jpg"
> im2.save("C:/nearest" + ext)
> im3.save("C:/Bicubic" + ext)
>
> print "files are saved"
>
>
>
> -- 
> Varsha Purohit,
> Graduate Student
>


--------------------------------------------------------------------------------


> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>



More information about the Tutor mailing list