View Single Post
Old 02-20-2019, 04:56 AM   #106
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,739
Karma: 24031403
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by AlanHK View Post
Everything else seems to work, BUT when I tried to run Kindlegen 0.53, which was working fine in Sigil 0.9.10, I get this error:
This problem is most likely caused by the legacy installer, because the plugin failed to import the PIL library, which should be bundled with Sigil. (The plugin works fine with the 64bit version.)

As a workaround comment out (or delete) the following sections from the code:

line 11

Code:
from PIL import Image
lines 556-569

Code:
    #------------------------------
    # check minimum cover width
    #------------------------------
    img = None
    if cover_id and os.path.splitext(bk.id_to_href(cover_id))[1][1:].upper() != 'SVG':
        imgdata = bk.readfile(cover_id)
        img = Image.open(BytesIO(imgdata)).convert('L')
        width, height = img.size
        if width < 500:
            plugin_warnings += '\nWarning: The cover is too small: ' + str(width) + ' x ' + str(height)
        # check recommended dpi
        if prefs['check_dpi'] == True:
            xdpi, ydpi = img.info['dpi']
            if (int(xdpi) or int(ydpi)) < 300:
                plugin_warnings += '\nInfo: Amazon recommends 300 dpi cover images. Your image has: ' + str(int(xdpi)) + ' x ' + str(int(ydpi)) + ' dpi.'
lines 897-915

Code:
        #================================================
        # generate mobi thumbnail image for eInk kindles
        #================================================
        if img and prefs['thumbnail'] == True:
            thumbnail_height = prefs['thumbnail_height']
            img.thumbnail((thumbnail_height, thumbnail_height), Image.ANTIALIAS)
            if prefs['add_asin'] == True:
                img_dest_path = os.path.join(dst_folder, 'thumbnail_' + asin + '_EBOK_portrait.jpg')
            else:
                if prefs['kfx'] == True and KFX_ASIN is not None:
                    img_dest_path = os.path.join(dst_folder, 'thumbnail_' + KFX_ASIN + '_EBOK_portrait.jpg')
                else:
                    img_dest_path = os.path.join(dst_folder, 'thumbnail_EBOK_portrait.jpg')
            img.save(img_dest_path)
            
            if os.path.isfile(img_dest_path):
                print('\nThumbnail copied to: ' + img_dest_path)
            else:
                print('\nPlugin Error: Thumbnail creation failed.')
Doitsu is offline   Reply With Quote