mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
py3k: Use relative imports
In py3k, imports are absolute unless using the "from . import" syntax. This commit also solves a recursive import between Image, ImageColor, and ImagePalette by delay-importing ImagePalette in Image. I'm not too keen on this commit because the syntax is ugly. I might go back and prefer the prettier "from PIL import".
This commit is contained in:
parent
abd215e457
commit
83ff0b3b31
|
@ -22,9 +22,9 @@ from __future__ import print_function
|
|||
|
||||
__version__ = "0.4"
|
||||
|
||||
import Image, ImageFile, ImagePalette
|
||||
from . import Image, ImageFile, ImagePalette
|
||||
|
||||
from PngImagePlugin import i16, i32, ChunkStream, _MODES
|
||||
from .PngImagePlugin import i16, i32, ChunkStream, _MODES
|
||||
|
||||
MAGIC = "\212ARG\r\n\032\n"
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image
|
||||
import FontFile
|
||||
from . import Image
|
||||
from . import FontFile
|
||||
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
__version__ = "0.7"
|
||||
|
||||
|
||||
import Image, ImageFile, ImagePalette
|
||||
from . import Image, ImageFile, ImagePalette
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
_handler = None
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
__version__ = "0.1"
|
||||
|
||||
import Image, BmpImagePlugin
|
||||
from . import Image, BmpImagePlugin
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
|
||||
__version__ = "0.2"
|
||||
|
||||
import Image
|
||||
from . import Image
|
||||
|
||||
from PcxImagePlugin import PcxImageFile
|
||||
from .PcxImagePlugin import PcxImageFile
|
||||
|
||||
MAGIC = 0x3ADE68B1 # QUIZ: what's this value, then?
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
__version__ = "0.5"
|
||||
|
||||
import re
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
_handler = None
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
__version__ = "0.2"
|
||||
|
||||
import Image, ImageFile, ImagePalette
|
||||
from . import Image, ImageFile, ImagePalette
|
||||
|
||||
|
||||
def i16(c):
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#
|
||||
|
||||
import os
|
||||
import Image
|
||||
from . import Image
|
||||
|
||||
import marshal
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
__version__ = "0.1"
|
||||
|
||||
|
||||
import Image, ImageFile
|
||||
from OleFileIO import *
|
||||
from . import Image, ImageFile
|
||||
from .OleFileIO import *
|
||||
|
||||
|
||||
# we map from colour field tuples to (mode, rawmode) descriptors
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
def i32(c):
|
||||
return ord(c[3]) + (ord(c[2])<<8) + (ord(c[1])<<16) + (ord(c[0])<<24L)
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
__version__ = "0.1"
|
||||
|
||||
import ImageFile, ImagePalette
|
||||
from . import ImageFile, ImagePalette
|
||||
|
||||
def i16(c):
|
||||
return ord(c[1]) + (ord(c[0])<<8)
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
__version__ = "0.9"
|
||||
|
||||
|
||||
import Image, ImageFile, ImagePalette
|
||||
from . import Image, ImageFile, ImagePalette
|
||||
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
_handler = None
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
_handler = None
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
import struct
|
||||
|
||||
HEADERSIZE = 8
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
__version__ = "0.1"
|
||||
|
||||
import Image, BmpImagePlugin
|
||||
from . import Image, BmpImagePlugin
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
__version__ = "0.7"
|
||||
|
||||
import re
|
||||
import Image, ImageFile, ImagePalette
|
||||
from . import Image, ImageFile, ImagePalette
|
||||
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
|
|
23
PIL/Image.py
23
PIL/Image.py
|
@ -66,8 +66,7 @@ except ImportError as v:
|
|||
RuntimeWarning
|
||||
)
|
||||
|
||||
import ImageMode
|
||||
import ImagePalette
|
||||
from . import ImageMode
|
||||
|
||||
import os, sys
|
||||
|
||||
|
@ -295,23 +294,23 @@ def preinit():
|
|||
return
|
||||
|
||||
try:
|
||||
import BmpImagePlugin
|
||||
from . import BmpImagePlugin
|
||||
except ImportError:
|
||||
pass
|
||||
try:
|
||||
import GifImagePlugin
|
||||
from . import GifImagePlugin
|
||||
except ImportError:
|
||||
pass
|
||||
try:
|
||||
import JpegImagePlugin
|
||||
from . import JpegImagePlugin
|
||||
except ImportError:
|
||||
pass
|
||||
try:
|
||||
import PpmImagePlugin
|
||||
from . import PpmImagePlugin
|
||||
except ImportError:
|
||||
pass
|
||||
try:
|
||||
import PngImagePlugin
|
||||
from . import PngImagePlugin
|
||||
except ImportError:
|
||||
pass
|
||||
# try:
|
||||
|
@ -464,6 +463,7 @@ class Image:
|
|||
new.size = im.size
|
||||
new.palette = self.palette
|
||||
if im.mode == "P":
|
||||
from . import ImagePalette
|
||||
new.palette = ImagePalette.ImagePalette()
|
||||
try:
|
||||
new.info = self.info.copy()
|
||||
|
@ -1014,7 +1014,7 @@ class Image:
|
|||
"'offset' is deprecated; use 'ImageChops.offset' instead",
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
import ImageChops
|
||||
from . import ImageChops
|
||||
return ImageChops.offset(self, xoffset, yoffset)
|
||||
|
||||
##
|
||||
|
@ -1081,7 +1081,7 @@ class Image:
|
|||
box = box + (box[0]+size[0], box[1]+size[1])
|
||||
|
||||
if isStringType(im):
|
||||
import ImageColor
|
||||
from . import ImageColor
|
||||
im = ImageColor.getcolor(im, self.mode)
|
||||
|
||||
elif isImageType(im):
|
||||
|
@ -1227,6 +1227,7 @@ class Image:
|
|||
|
||||
def putpalette(self, data, rawmode="RGB"):
|
||||
"Put palette data into an image."
|
||||
from . import ImagePalette
|
||||
|
||||
if self.mode not in ("L", "P"):
|
||||
raise ValueError("illegal image mode")
|
||||
|
@ -1758,7 +1759,7 @@ def new(mode, size, color=0):
|
|||
if isStringType(color):
|
||||
# css3-style specifier
|
||||
|
||||
import ImageColor
|
||||
from . import ImageColor
|
||||
color = ImageColor.getcolor(color, mode)
|
||||
|
||||
return Image()._new(core.fill(mode, size, color))
|
||||
|
@ -2139,5 +2140,5 @@ def _show(image, **options):
|
|||
apply(_showxv, (image,), options)
|
||||
|
||||
def _showxv(image, title=None, **options):
|
||||
import ImageShow
|
||||
from . import ImageShow
|
||||
apply(ImageShow.show, (image, title), options)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image
|
||||
from . import Image
|
||||
|
||||
##
|
||||
# The <b>ImageChops</b> module contains a number of arithmetical image
|
||||
|
|
|
@ -81,7 +81,7 @@ VERSION = "0.1.0 pil"
|
|||
|
||||
# --------------------------------------------------------------------.
|
||||
|
||||
import Image
|
||||
from . import Image
|
||||
import _imagingcms
|
||||
|
||||
core = _imagingcms
|
||||
|
@ -207,7 +207,7 @@ class ImageCmsTransform(Image.ImagePointHandler):
|
|||
def get_display_profile(handle=None):
|
||||
import sys
|
||||
if sys.platform == "win32":
|
||||
import ImageWin
|
||||
from . import ImageWin
|
||||
if isinstance(handle, ImageWin.HDC):
|
||||
profile = core.get_display_profile_win32(handle, 1)
|
||||
else:
|
||||
|
@ -771,7 +771,7 @@ def versions():
|
|||
if __name__ == "__main__":
|
||||
# create a cheap manual from the __doc__ strings for the functions above
|
||||
|
||||
import ImageCms
|
||||
from . import ImageCms
|
||||
print(__doc__)
|
||||
|
||||
for f in dir(pyCMS):
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image
|
||||
from . import Image
|
||||
import re
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image, ImageColor
|
||||
from . import Image, ImageColor
|
||||
|
||||
try:
|
||||
import warnings
|
||||
|
@ -127,7 +127,7 @@ class ImageDraw:
|
|||
def getfont(self):
|
||||
if not self.font:
|
||||
# FIXME: should add a font repository
|
||||
import ImageFont
|
||||
from . import ImageFont
|
||||
self.font = ImageFont.load_default()
|
||||
return self.font
|
||||
|
||||
|
@ -318,7 +318,7 @@ def getdraw(im=None, hints=None):
|
|||
except ImportError:
|
||||
pass
|
||||
if handler is None:
|
||||
import ImageDraw2
|
||||
from . import ImageDraw2
|
||||
handler = ImageDraw2
|
||||
if im:
|
||||
im = handler.Draw(im)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image, ImageColor, ImageDraw, ImageFont, ImagePath
|
||||
from . import Image, ImageColor, ImageDraw, ImageFont, ImagePath
|
||||
|
||||
class Pen:
|
||||
def __init__(self, color, width=1, opacity=255):
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image, ImageFilter, ImageStat
|
||||
from . import Image, ImageFilter, ImageStat
|
||||
|
||||
class _Enhance:
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image
|
||||
from . import Image
|
||||
import traceback, os
|
||||
import io
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
from __future__ import print_function
|
||||
|
||||
import Image
|
||||
from . import Image
|
||||
import os, sys
|
||||
|
||||
class _imagingft_not_installed:
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image
|
||||
from . import Image
|
||||
|
||||
##
|
||||
# (New in 1.1.3) The <b>ImageGrab</b> module can be used to copy
|
||||
|
@ -66,6 +66,7 @@ def grabclipboard():
|
|||
debug = 0 # temporary interface
|
||||
data = Image.core.grabclipboard(debug)
|
||||
if Image.isStringType(data):
|
||||
import BmpImagePlugin, StringIO
|
||||
from . import BmpImagePlugin
|
||||
import StringIO
|
||||
return BmpImagePlugin.DibImageFile(StringIO.StringIO(data))
|
||||
return data
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image
|
||||
from . import Image
|
||||
import _imagingmath
|
||||
import sys
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class ModeDescriptor:
|
|||
def getmode(mode):
|
||||
if not _modes:
|
||||
# initialize mode cache
|
||||
import Image
|
||||
from . import Image
|
||||
# core modes
|
||||
for m, (basemode, basetype, bands) in Image._MODEINFO.items():
|
||||
_modes[m] = ModeDescriptor(m, bands, basemode, basetype)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image
|
||||
from . import Image
|
||||
import operator
|
||||
from functools import reduce
|
||||
|
||||
|
@ -44,7 +44,7 @@ def _border(border):
|
|||
|
||||
def _color(color, mode):
|
||||
if Image.isStringType(color):
|
||||
import ImageColor
|
||||
from . import ImageColor
|
||||
color = ImageColor.getcolor(color, mode)
|
||||
return color
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#
|
||||
|
||||
import array
|
||||
import Image, ImageColor
|
||||
from . import Image, ImageColor
|
||||
|
||||
##
|
||||
# Colour palette wrapper for palette mapped images.
|
||||
|
@ -150,7 +150,7 @@ def load(filename):
|
|||
|
||||
if not lut:
|
||||
try:
|
||||
import GimpPaletteFile
|
||||
from . import GimpPaletteFile
|
||||
fp.seek(0)
|
||||
p = GimpPaletteFile.GimpPaletteFile(fp)
|
||||
lut = p.getpalette()
|
||||
|
@ -159,7 +159,7 @@ def load(filename):
|
|||
|
||||
if not lut:
|
||||
try:
|
||||
import GimpGradientFile
|
||||
from . import GimpGradientFile
|
||||
fp.seek(0)
|
||||
p = GimpGradientFile.GimpGradientFile(fp)
|
||||
lut = p.getpalette()
|
||||
|
@ -168,7 +168,7 @@ def load(filename):
|
|||
|
||||
if not lut:
|
||||
try:
|
||||
import PaletteFile
|
||||
from . import PaletteFile
|
||||
fp.seek(0)
|
||||
p = PaletteFile.PaletteFile(fp)
|
||||
lut = p.getpalette()
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image
|
||||
from . import Image
|
||||
|
||||
##
|
||||
# Path wrapper.
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image
|
||||
from . import Image
|
||||
|
||||
from PyQt4.QtGui import QImage, qRgb
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
from __future__ import print_function
|
||||
|
||||
import Image
|
||||
from . import Image
|
||||
import os, sys
|
||||
|
||||
_viewers = []
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image
|
||||
from . import Image
|
||||
import operator, math
|
||||
from functools import reduce
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Tkinter, Image
|
||||
import Tkinter
|
||||
from . import Image
|
||||
|
||||
##
|
||||
# The <b>ImageTk</b> module contains support to create and modify
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image
|
||||
from . import Image
|
||||
|
||||
class Transform(Image.ImageTransformHandler):
|
||||
def __init__(self, data):
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image
|
||||
from . import Image
|
||||
|
||||
##
|
||||
# The <b>ImageWin</b> module contains support to create and display
|
||||
|
|
|
@ -19,7 +19,7 @@ __version__ = "0.2"
|
|||
|
||||
import re
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
|
|
|
@ -20,7 +20,7 @@ from __future__ import print_function
|
|||
__version__ = "0.3"
|
||||
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
import os, tempfile
|
||||
|
||||
|
||||
|
@ -219,7 +219,7 @@ Image.register_extension("IPTC", ".iim")
|
|||
|
||||
def getiptcinfo(im):
|
||||
|
||||
import TiffImagePlugin, JpegImagePlugin
|
||||
from . import TiffImagePlugin, JpegImagePlugin
|
||||
import StringIO
|
||||
|
||||
data = None
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
__version__ = "0.6"
|
||||
|
||||
import array, struct
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
def i16(c,o=0):
|
||||
return ord(c[o+1]) + (ord(c[o])<<8)
|
||||
|
@ -361,7 +361,8 @@ class JpegImageFile(ImageFile.ImageFile):
|
|||
# Extract EXIF information. This method is highly experimental,
|
||||
# and is likely to be replaced with something better in a future
|
||||
# version.
|
||||
import TiffImagePlugin, StringIO
|
||||
from . import TiffImagePlugin
|
||||
import StringIO
|
||||
def fixup(value):
|
||||
if len(value) == 1:
|
||||
return value[0]
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
__version__ = "0.2"
|
||||
|
||||
import struct
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
def _accept(s):
|
||||
return s[:8] == "\x00\x00\x00\x00\x00\x00\x00\x04"
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
__version__ = "0.1"
|
||||
|
||||
|
||||
import Image, TiffImagePlugin
|
||||
from OleFileIO import *
|
||||
from . import Image, TiffImagePlugin
|
||||
from .OleFileIO import *
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
__version__ = "0.1"
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
#
|
||||
# Bitstream parser
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
__version__ = "0.1"
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
from __future__ import print_function
|
||||
|
||||
import EpsImagePlugin
|
||||
from . import EpsImagePlugin
|
||||
|
||||
##
|
||||
# Simple Postscript graphics interface.
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
__version__ = "1.0"
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
_Palm8BitColormapValues = (
|
||||
( 255, 255, 255 ), ( 255, 204, 255 ), ( 255, 153, 255 ), ( 255, 102, 255 ),
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
__version__ = "0.1"
|
||||
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
##
|
||||
# Image plugin for PhotoCD images. This plugin only reads the 768x512
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import Image
|
||||
import FontFile
|
||||
from . import Image
|
||||
from . import FontFile
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# declarations
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
__version__ = "0.6"
|
||||
|
||||
import Image, ImageFile, ImagePalette
|
||||
from . import Image, ImageFile, ImagePalette
|
||||
|
||||
def i16(c,o):
|
||||
return ord(c[o]) + (ord(c[o+1])<<8)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
__version__ = "0.4"
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
import StringIO
|
||||
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
__version__ = "0.1"
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
#
|
||||
# helpers
|
||||
|
|
|
@ -37,7 +37,8 @@ __version__ = "0.9"
|
|||
|
||||
import re
|
||||
|
||||
import Image, ImageFile, ImagePalette, zlib
|
||||
from . import Image, ImageFile, ImagePalette
|
||||
import zlib
|
||||
|
||||
|
||||
def i16(c):
|
||||
|
|
|
@ -19,7 +19,7 @@ __version__ = "0.2"
|
|||
|
||||
import string
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
__version__ = "0.4"
|
||||
|
||||
import Image, ImageFile, ImagePalette
|
||||
from . import Image, ImageFile, ImagePalette
|
||||
|
||||
MODES = {
|
||||
# (photoshop mode, bits) -> (pil mode, required channels)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
__version__ = "0.2"
|
||||
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
|
||||
def i16(c):
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
from __future__ import print_function
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
import os, struct, sys
|
||||
|
||||
def isInt(f):
|
||||
|
@ -173,7 +173,7 @@ class SpiderImageFile(ImageFile.ImageFile):
|
|||
|
||||
# returns a ImageTk.PhotoImage object, after rescaling to 0..255
|
||||
def tkPhotoImage(self):
|
||||
import ImageTk
|
||||
from . import ImageTk
|
||||
return ImageTk.PhotoImage(self.convert2byte(), palette=256)
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
__version__ = "0.3"
|
||||
|
||||
|
||||
import Image, ImageFile, ImagePalette
|
||||
from . import Image, ImageFile, ImagePalette
|
||||
|
||||
|
||||
def i16(c):
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import ContainerIO
|
||||
from . import ContainerIO
|
||||
|
||||
##
|
||||
# A file object that provides read access to a given member of a TAR
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
__version__ = "0.3"
|
||||
|
||||
import Image, ImageFile, ImagePalette
|
||||
from . import Image, ImageFile, ImagePalette
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -43,8 +43,8 @@ from __future__ import print_function
|
|||
|
||||
__version__ = "1.3.5"
|
||||
|
||||
import Image, ImageFile
|
||||
import ImagePalette
|
||||
from . import Image, ImageFile
|
||||
from . import ImagePalette
|
||||
|
||||
import array, sys
|
||||
import collections
|
||||
|
@ -351,7 +351,7 @@ class ImageFileDirectory(collections.MutableMapping):
|
|||
tag, typ = i16(ifd), i16(ifd, 2)
|
||||
|
||||
if Image.DEBUG:
|
||||
import TiffTags
|
||||
from . import TiffTags
|
||||
tagname = TiffTags.TAGS.get(tag, "unknown")
|
||||
typname = TiffTags.TYPES.get(typ, "unknown")
|
||||
print("tag: %s (%d)" % (tagname, tag), end=' ')
|
||||
|
@ -448,7 +448,7 @@ class ImageFileDirectory(collections.MutableMapping):
|
|||
data = "".join(map(o32, value))
|
||||
|
||||
if Image.DEBUG:
|
||||
import TiffTags
|
||||
from . import TiffTags
|
||||
tagname = TiffTags.TAGS.get(tag, "unknown")
|
||||
typname = TiffTags.TYPES.get(typ, "unknown")
|
||||
print("save: %s (%d)" % (tagname, tag), end=' ')
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
from __future__ import print_function
|
||||
|
||||
import Image
|
||||
from . import Image
|
||||
|
||||
def i32(c, o=0):
|
||||
return ord(c[o])+(ord(c[o+1])<<8)+(ord(c[o+2])<<16)+(ord(c[o+3])<<24)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
__version__ = "0.2"
|
||||
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
_handler = None
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
__version__ = "0.1"
|
||||
|
||||
import Image, ImageFile, ImagePalette
|
||||
from . import Image, ImageFile, ImagePalette
|
||||
|
||||
# standard color palette for thumbnails (RGB332)
|
||||
PALETTE = ""
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
__version__ = "0.6"
|
||||
|
||||
import re
|
||||
import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
# XBM header
|
||||
xbm_head = re.compile(
|
||||
|
|
|
@ -19,7 +19,7 @@ __version__ = "0.2"
|
|||
|
||||
|
||||
import re
|
||||
import Image, ImageFile, ImagePalette
|
||||
from . import Image, ImageFile, ImagePalette
|
||||
|
||||
# XPM header
|
||||
xpm_head = re.compile("\"([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*)")
|
||||
|
|
Loading…
Reference in New Issue
Block a user