I have a Flask Web App that loads and manipulates JPEG images. To improve performance I would like to preprocess some of these images using a cron job. While the code works fairly well in a Flask Context, I don't succeed in running the same code from a bash console or through cron. The stack trace I got looks like this:
Traceback (most recent call last):
File "teampicscron.py", line 61, in <module>
img = img.crop((int(x_offset), int(y_offset), int(x_offset)+int(crop_width), int(y_offset)+int(crop_height)))
File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 763, in crop
self.load()
File "/usr/local/lib/python2.7/dist-packages/PIL/ImageFile.py", line 189, in load
d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 385, in _getdecoder
raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available