Imageproxy code fix and cleanup

Cleaned up the code in htpc/proxy.py to fix thumbnail generation on Ubuntu x64.
Havent tested on other repos.
Still doesnt work with the supplied PIL but work if you remove the PIL from /libs/.