Restore code in function doThumbnail()

The bug was in the old jpeg library (6) the python 2.7 was compiled with.
Re-built python with libjpeg8 libjpeg8-dev