[Tutor] Comparing images, was Re: principal question

Peter Otten __peter__ at web.de
Sat Jul 8 07:28:44 EDT 2017


marcus lütolf wrote:

> dear experts,
> before I start digging into writing code I'd like your opinion:
> 
> Is it possible 

Yes. Now what?

> to have python compare 2   subsequent  *.jpg  images in
> subtracting the pixel values of the second from the first image.
> If the images and are identical the result should be 0 and the first image
> could be deletet.
> If there is a difference (treshold pixel value  and pixel numer to be
> determined) another action should be executed.

I assume you know how to list files in a directory and to remove a file 
given its path?

To process the images you need pillow to load an image and numpy to access 
the pixels in a convenient and efficient format.

Google found 

https://pythonprogramming.net/python-pixel-arrays/

which illustrates the first steps.



More information about the Tutor mailing list