Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
greetings,

i have this code and it works perfectly. this code checks c:\a folder in every 6 seconds and if any new image comes in this folder, invert it and than copy to c:\b folder. how can i convert this code to PIL? I want to add some extra image processing codes and doing this with PIL is much more easier.

Python
import cv2
import numpy
import filecmp
import time
import os


old=set(os.listdir('C:/a'))
while (1):
    new = set(os.listdir('C:/a'))
    if(new!=old):
        difference = new.difference(old)
        for images in difference:

            img = cv2.imread('C:/a/' + images)
            
            inverted = (255-img)
                        
            cv2.imwrite('C:/b/' + images + 'IVISION.jpg',inverted)
            
    time.sleep(6)
    old =  new
Posted
Comments
Member 10587827 27-May-15 8:13am    
is there someone to help me?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900