Created
August 20, 2013 10:34
-
-
Save milkersarac/6279851 to your computer and use it in GitHub Desktop.
This script reads images and shows to the user one by one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#1.This script reads images and shows to the user one by one. | |
#2.The images must be stored in a directory named "Images" | |
#3.User chooses the desired images by pressing "enter", if the image is not desired | |
# user should press "." first then hit "enter". If no action is desired simply | |
# press any other key then enter. | |
#4.The result images will be coppied under 2 directories created by the script. | |
# | |
#For the best performance the terminal should be arranged to "Always on Top" mode. By right | |
#clicking to the upper frame of the terminal. | |
# | |
#@milkers | |
#13.08.2013 v1.0 | |
import Image | |
import shutil | |
import glob, os | |
import subprocess | |
#shutil.copy2("merkel.jpg", "im/") | |
#im = Image.open("merkel.jpg") | |
#im.show() | |
try: | |
os.mkdir("selectedImages/") | |
os.mkdir("ignoredImages/") | |
except Exception, e: | |
print "Please handle the files from previous session" | |
exit() | |
for infile in glob.glob("Images/*"): | |
#im = Image.open(infile) | |
#im.show() | |
#p = subprocess.call(['firefox', infile]) | |
p = subprocess.Popen(["display", infile]) | |
var = raw_input("Enter label: ") | |
if var == "": | |
shutil.copy2(infile, "selectedImages/") | |
p.kill() | |
print "image copied" | |
elif var == ".": | |
shutil.copy2(infile, "ignoredImages/") | |
p.kill() | |
print "image skipped" | |
else: | |
p.kill() | |
print "image skipped" | |
print "END" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment