I have a python function that takes in an image path and outputs true or false depending whether the image is black or not. I want to process several images on the same machine
I would suggest looking at Pools to easily create processes on the fly. If you need to have some shared state, in this case a boolean indicating a non-black image has been found, look at Managers.
Update: Here is an example of what I mean.
import multiprocessing.Manager as Manager
import multiprocessing.Pool as Pool
m = Manager()
p = Pool(processes=5)
state_info = m.dict()
state_info['image_found'] = False
def processImage(img):
# ... Process Image ...
if imageIsBlack(img):
state_info['image_found'] = True
p.terminate()
p.apply(processImage, imageList)
if state_info['image_found']:
print 'There was a black image!!'
else:
print 'No black images were found.'