Couple of things:
1) Dont use NamedTemporaryFile, use one of the functions from calibre.ptempfile instead as they handle temp file locations in a consistent manner.
2) Dont use PIL, use the save_cover_data_to function from calibre/utils/magick/draw.py it is more robust (PIL is unmaintained, that function uses ImageMagick).
|