Thread: pdftoiliad
View Single Post
Old 07-14-2008, 11:54 AM   #7
kusmi
Connoisseur
kusmi began at the beginning.
 
kusmi's Avatar
 
Posts: 73
Karma: 16
Join Date: Jul 2006
Location: Zurich, Switzerland
I also added a bit better contrast (if the title page of the pdf only contains text, the cover icon is hard to read), so the cover code now looks like this:

Code:
#-------- Create thumbnail --------
def make_cover(cover, out):
    """Takes a PIL image and returns the image transformed
    to be used as a thumbnail on the Iliad"""
    if cover:
        try:
            coversize = (69, 93)
            out = os.path.join(out, "cover.png")
            cover = ImageOps.grayscale(cover)
            cover.thumbnail(coversize, Image.ANTIALIAS)
            cover = ImageOps.autocontrast(cover,0)
            cover.save(out)
            return True
        except: return False
    else:
        return False
Again, many thanks for your great tool - it is really useful!!!
kusmi is offline   Reply With Quote