mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 14:46:52 +02:00
Only import Pillow from PIL
This commit is contained in:
parent
3a6ad1e03a
commit
d5bb19f8ec
9 changed files with 9 additions and 47 deletions
|
|
@ -383,11 +383,7 @@ class WEBOS(USBMS):
|
|||
|
||||
def upload_cover(self, path, filename, metadata, filepath):
|
||||
|
||||
try:
|
||||
from PIL import Image, ImageDraw
|
||||
Image, ImageDraw
|
||||
except ImportError:
|
||||
import Image, ImageDraw
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
coverdata = getattr(metadata, 'thumbnail', None)
|
||||
if coverdata and coverdata[2]:
|
||||
|
|
|
|||
|
|
@ -48,11 +48,7 @@ class NOOK(USBMS):
|
|||
SUPPORTS_SUB_DIRS = True
|
||||
|
||||
def upload_cover(self, path, filename, metadata, filepath):
|
||||
try:
|
||||
from PIL import Image, ImageDraw
|
||||
Image, ImageDraw
|
||||
except ImportError:
|
||||
import Image, ImageDraw
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
coverdata = getattr(metadata, 'thumbnail', None)
|
||||
if coverdata and coverdata[2]:
|
||||
|
|
|
|||
|
|
@ -56,11 +56,7 @@ def convert(self, oeb_book, output_path, input_plugin, opts, log):
|
|||
pmlz.add_dir(tdir)
|
||||
|
||||
def write_images(self, manifest, image_hrefs, out_dir, opts):
|
||||
try:
|
||||
from PIL import Image
|
||||
Image
|
||||
except ImportError:
|
||||
import Image
|
||||
from PIL import Image
|
||||
|
||||
from calibre.ebooks.oeb.base import OEB_RASTER_IMAGES
|
||||
for item in manifest:
|
||||
|
|
|
|||
|
|
@ -3,11 +3,7 @@
|
|||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
try:
|
||||
from PIL import ImageFont
|
||||
ImageFont
|
||||
except ImportError:
|
||||
import ImageFont
|
||||
from PIL import ImageFont
|
||||
|
||||
'''
|
||||
Default fonts used in the PRS500
|
||||
|
|
|
|||
|
|
@ -42,11 +42,7 @@
|
|||
and to Falstaff for pylrs.
|
||||
"""
|
||||
|
||||
try:
|
||||
from PIL import Image as PILImage
|
||||
PILImage
|
||||
except ImportError:
|
||||
import Image as PILImage
|
||||
from PIL import Image as PILImage
|
||||
|
||||
|
||||
def update_css(ncss, ocss):
|
||||
|
|
|
|||
|
|
@ -14,11 +14,7 @@
|
|||
import struct
|
||||
import zlib
|
||||
|
||||
try:
|
||||
from PIL import Image
|
||||
Image
|
||||
except ImportError:
|
||||
import Image
|
||||
from PIL import Image
|
||||
|
||||
from calibre.ebooks.pdb.formatwriter import FormatWriter
|
||||
from calibre.ebooks.pdb.header import PdbHeaderBuilder
|
||||
|
|
|
|||
|
|
@ -9,11 +9,7 @@
|
|||
import struct
|
||||
import zlib
|
||||
|
||||
try:
|
||||
from PIL import Image
|
||||
Image
|
||||
except ImportError:
|
||||
import Image
|
||||
from PIL import Image
|
||||
|
||||
from calibre.ebooks.rb.rbml import RBMLizer
|
||||
from calibre.ebooks.rb import HEADER
|
||||
|
|
|
|||
|
|
@ -89,13 +89,7 @@ def getimagesize(url):
|
|||
|
||||
"""
|
||||
|
||||
try:
|
||||
from PIL import ImageFile
|
||||
except ImportError:
|
||||
try:
|
||||
import ImageFile
|
||||
except ImportError:
|
||||
return None
|
||||
from PIL import ImageFile
|
||||
|
||||
try:
|
||||
p = ImageFile.Parser()
|
||||
|
|
|
|||
|
|
@ -2953,11 +2953,7 @@ def generate_masthead_image(self, out_path):
|
|||
if not font_path or not os.access(font_path, os.R_OK):
|
||||
font_path = default_font
|
||||
|
||||
try:
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
Image, ImageDraw, ImageFont
|
||||
except ImportError:
|
||||
import Image, ImageDraw, ImageFont
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
img = Image.new('RGB', (MI_WIDTH, MI_HEIGHT), 'white')
|
||||
draw = ImageDraw.Draw(img)
|
||||
|
|
|
|||
Loading…
Reference in a new issue