mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Only import Pillow from PIL
This commit is contained in:
parent
3a6ad1e03a
commit
d5bb19f8ec
@ -383,11 +383,7 @@ class WEBOS(USBMS):
|
|||||||
|
|
||||||
def upload_cover(self, path, filename, metadata, filepath):
|
def upload_cover(self, path, filename, metadata, filepath):
|
||||||
|
|
||||||
try:
|
from PIL import Image, ImageDraw
|
||||||
from PIL import Image, ImageDraw
|
|
||||||
Image, ImageDraw
|
|
||||||
except ImportError:
|
|
||||||
import Image, ImageDraw
|
|
||||||
|
|
||||||
coverdata = getattr(metadata, 'thumbnail', None)
|
coverdata = getattr(metadata, 'thumbnail', None)
|
||||||
if coverdata and coverdata[2]:
|
if coverdata and coverdata[2]:
|
||||||
|
@ -48,11 +48,7 @@ class NOOK(USBMS):
|
|||||||
SUPPORTS_SUB_DIRS = True
|
SUPPORTS_SUB_DIRS = True
|
||||||
|
|
||||||
def upload_cover(self, path, filename, metadata, filepath):
|
def upload_cover(self, path, filename, metadata, filepath):
|
||||||
try:
|
from PIL import Image, ImageDraw
|
||||||
from PIL import Image, ImageDraw
|
|
||||||
Image, ImageDraw
|
|
||||||
except ImportError:
|
|
||||||
import Image, ImageDraw
|
|
||||||
|
|
||||||
coverdata = getattr(metadata, 'thumbnail', None)
|
coverdata = getattr(metadata, 'thumbnail', None)
|
||||||
if coverdata and coverdata[2]:
|
if coverdata and coverdata[2]:
|
||||||
|
@ -56,11 +56,7 @@ class PMLOutput(OutputFormatPlugin):
|
|||||||
pmlz.add_dir(tdir)
|
pmlz.add_dir(tdir)
|
||||||
|
|
||||||
def write_images(self, manifest, image_hrefs, out_dir, opts):
|
def write_images(self, manifest, image_hrefs, out_dir, opts):
|
||||||
try:
|
from PIL import Image
|
||||||
from PIL import Image
|
|
||||||
Image
|
|
||||||
except ImportError:
|
|
||||||
import Image
|
|
||||||
|
|
||||||
from calibre.ebooks.oeb.base import OEB_RASTER_IMAGES
|
from calibre.ebooks.oeb.base import OEB_RASTER_IMAGES
|
||||||
for item in manifest:
|
for item in manifest:
|
||||||
|
@ -3,11 +3,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
|
|
||||||
try:
|
from PIL import ImageFont
|
||||||
from PIL import ImageFont
|
|
||||||
ImageFont
|
|
||||||
except ImportError:
|
|
||||||
import ImageFont
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Default fonts used in the PRS500
|
Default fonts used in the PRS500
|
||||||
|
@ -42,11 +42,7 @@ I am indebted to esperanc for the initial CSS->Xylog Style conversion code
|
|||||||
and to Falstaff for pylrs.
|
and to Falstaff for pylrs.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
from PIL import Image as PILImage
|
||||||
from PIL import Image as PILImage
|
|
||||||
PILImage
|
|
||||||
except ImportError:
|
|
||||||
import Image as PILImage
|
|
||||||
|
|
||||||
|
|
||||||
def update_css(ncss, ocss):
|
def update_css(ncss, ocss):
|
||||||
|
@ -14,11 +14,7 @@ import re
|
|||||||
import struct
|
import struct
|
||||||
import zlib
|
import zlib
|
||||||
|
|
||||||
try:
|
from PIL import Image
|
||||||
from PIL import Image
|
|
||||||
Image
|
|
||||||
except ImportError:
|
|
||||||
import Image
|
|
||||||
|
|
||||||
from calibre.ebooks.pdb.formatwriter import FormatWriter
|
from calibre.ebooks.pdb.formatwriter import FormatWriter
|
||||||
from calibre.ebooks.pdb.header import PdbHeaderBuilder
|
from calibre.ebooks.pdb.header import PdbHeaderBuilder
|
||||||
|
@ -9,11 +9,7 @@ import io
|
|||||||
import struct
|
import struct
|
||||||
import zlib
|
import zlib
|
||||||
|
|
||||||
try:
|
from PIL import Image
|
||||||
from PIL import Image
|
|
||||||
Image
|
|
||||||
except ImportError:
|
|
||||||
import Image
|
|
||||||
|
|
||||||
from calibre.ebooks.rb.rbml import RBMLizer
|
from calibre.ebooks.rb.rbml import RBMLizer
|
||||||
from calibre.ebooks.rb import HEADER
|
from calibre.ebooks.rb import HEADER
|
||||||
|
@ -89,13 +89,7 @@ def getimagesize(url):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
from PIL import ImageFile
|
||||||
from PIL import ImageFile
|
|
||||||
except ImportError:
|
|
||||||
try:
|
|
||||||
import ImageFile
|
|
||||||
except ImportError:
|
|
||||||
return None
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
p = ImageFile.Parser()
|
p = ImageFile.Parser()
|
||||||
|
@ -2953,11 +2953,7 @@ class CatalogBuilder(object):
|
|||||||
if not font_path or not os.access(font_path, os.R_OK):
|
if not font_path or not os.access(font_path, os.R_OK):
|
||||||
font_path = default_font
|
font_path = default_font
|
||||||
|
|
||||||
try:
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
|
||||||
Image, ImageDraw, ImageFont
|
|
||||||
except ImportError:
|
|
||||||
import Image, ImageDraw, ImageFont
|
|
||||||
|
|
||||||
img = Image.new('RGB', (MI_WIDTH, MI_HEIGHT), 'white')
|
img = Image.new('RGB', (MI_WIDTH, MI_HEIGHT), 'white')
|
||||||
draw = ImageDraw.Draw(img)
|
draw = ImageDraw.Draw(img)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user