import glob images = [] if os.path.exists(path): for imagePath in glob.glob("%s*%s" % (path, ext)): images.append(imagePath) return images threadList = [] count = 0 while count < THREAD_COUNT: threadList.append("Thread-%d" % count) count += 1 nameList = sql.allComics() # nameList = filesFromFolder('../images/tatto/') if len(nameList) == 0: exit(0) writeLock = threading.Semaphore(15) queueLock = threading.Lock() workQueue = Queue.Queue(1000000) threads = [] threadID = 1 # Create new threads for tName in threadList: thread = HashThread(threadID, tName, workQueue, queueLock, writeLock) thread.daemon = True
def downloadImages(): nameList = sql.allComics()[:1000] for i in nameList: img = im.loadImageFromUrl(i, color=cv2.IMREAD_COLOR, resize=False, maxSize=800) cv2.imwrite('/home/evgeniy/projects/python/open-cv/images/comics/full/%s.jpg' % im.fileName(i), img)