[Tutor] [tutor]Imagechop error

Tiger12506 keridee at jayco.net
Sun Feb 3 06:04:40 CET 2008


> Hello everyone,
>        I am tryin to use the imagechop module but i am not able to
> implement it successfully. I want to compare two images and give the
> resultant of the image using difference module. i am tryin to save the
> resultant image. But i am getting some wierd error. It gives error in the
> line where i have used imagechop.difference and the error is
>
> AttributeError: 'str' object has no attribute 'load'    I am unable to
> understand what is the problem. Can any one help me understand this
> imagechop module ??

I am 80% sure that this means it wants you to load the jpg files first, and 
then pass in those jpg objects into the difference function.


>
> import Image
> import ImageChops
>
> file1 = "Nearest.jpg"
> file2 = "Bilinear.jpg"
>
> diff = ImageChops.difference(file1, file2)
>
> ext = ".jpg"
> diff.save("diff" + ext, "JPEG", quality =100)
>
> -- 
> Varsha Purohit,
> Graduate Student
>


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


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



More information about the Tutor mailing list