diff --git a/PIL/ArgImagePlugin.py b/PIL/ArgImagePlugin.py
index ea9914deb..c192dd955 100644
--- a/PIL/ArgImagePlugin.py
+++ b/PIL/ArgImagePlugin.py
@@ -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"
diff --git a/PIL/BdfFontFile.py b/PIL/BdfFontFile.py
index eb656d3ac..5b38d5957 100644
--- a/PIL/BdfFontFile.py
+++ b/PIL/BdfFontFile.py
@@ -17,8 +17,8 @@
# See the README file for information on usage and redistribution.
#
-import Image
-import FontFile
+from . import Image
+from . import FontFile
# --------------------------------------------------------------------
diff --git a/PIL/BmpImagePlugin.py b/PIL/BmpImagePlugin.py
index eb9a0bf60..ad59d5de9 100644
--- a/PIL/BmpImagePlugin.py
+++ b/PIL/BmpImagePlugin.py
@@ -27,7 +27,7 @@
__version__ = "0.7"
-import Image, ImageFile, ImagePalette
+from . import Image, ImageFile, ImagePalette
#
diff --git a/PIL/BufrStubImagePlugin.py b/PIL/BufrStubImagePlugin.py
index 4b111b393..e17bada90 100644
--- a/PIL/BufrStubImagePlugin.py
+++ b/PIL/BufrStubImagePlugin.py
@@ -9,7 +9,7 @@
# See the README file for information on usage and redistribution.
#
-import Image, ImageFile
+from . import Image, ImageFile
_handler = None
diff --git a/PIL/CurImagePlugin.py b/PIL/CurImagePlugin.py
index 98b971c0a..c2c46e270 100644
--- a/PIL/CurImagePlugin.py
+++ b/PIL/CurImagePlugin.py
@@ -19,7 +19,7 @@
__version__ = "0.1"
-import Image, BmpImagePlugin
+from . import Image, BmpImagePlugin
#
diff --git a/PIL/DcxImagePlugin.py b/PIL/DcxImagePlugin.py
index 60c022f8e..9a512c28c 100644
--- a/PIL/DcxImagePlugin.py
+++ b/PIL/DcxImagePlugin.py
@@ -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?
diff --git a/PIL/EpsImagePlugin.py b/PIL/EpsImagePlugin.py
index 450ba2422..9910f382a 100644
--- a/PIL/EpsImagePlugin.py
+++ b/PIL/EpsImagePlugin.py
@@ -21,7 +21,7 @@
__version__ = "0.5"
import re
-import Image, ImageFile
+from . import Image, ImageFile
#
# --------------------------------------------------------------------
diff --git a/PIL/FitsStubImagePlugin.py b/PIL/FitsStubImagePlugin.py
index ac8be80a9..f442caefc 100644
--- a/PIL/FitsStubImagePlugin.py
+++ b/PIL/FitsStubImagePlugin.py
@@ -9,7 +9,7 @@
# See the README file for information on usage and redistribution.
#
-import Image, ImageFile
+from . import Image, ImageFile
_handler = None
diff --git a/PIL/FliImagePlugin.py b/PIL/FliImagePlugin.py
index 8f48e29b8..1404cb9e5 100644
--- a/PIL/FliImagePlugin.py
+++ b/PIL/FliImagePlugin.py
@@ -18,7 +18,7 @@
__version__ = "0.2"
-import Image, ImageFile, ImagePalette
+from . import Image, ImageFile, ImagePalette
def i16(c):
diff --git a/PIL/FontFile.py b/PIL/FontFile.py
index d9d8eb38a..a7912fefc 100644
--- a/PIL/FontFile.py
+++ b/PIL/FontFile.py
@@ -15,7 +15,7 @@
#
import os
-import Image
+from . import Image
import marshal
diff --git a/PIL/FpxImagePlugin.py b/PIL/FpxImagePlugin.py
index e44c667ba..6612c3e1a 100644
--- a/PIL/FpxImagePlugin.py
+++ b/PIL/FpxImagePlugin.py
@@ -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
diff --git a/PIL/GbrImagePlugin.py b/PIL/GbrImagePlugin.py
index db48bf968..3efcb730c 100644
--- a/PIL/GbrImagePlugin.py
+++ b/PIL/GbrImagePlugin.py
@@ -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)
diff --git a/PIL/GdImageFile.py b/PIL/GdImageFile.py
index b5f1dd25d..e211d3528 100644
--- a/PIL/GdImageFile.py
+++ b/PIL/GdImageFile.py
@@ -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)
diff --git a/PIL/GifImagePlugin.py b/PIL/GifImagePlugin.py
index fa3b66643..138627574 100644
--- a/PIL/GifImagePlugin.py
+++ b/PIL/GifImagePlugin.py
@@ -28,7 +28,7 @@
__version__ = "0.9"
-import Image, ImageFile, ImagePalette
+from . import Image, ImageFile, ImagePalette
# --------------------------------------------------------------------
diff --git a/PIL/GribStubImagePlugin.py b/PIL/GribStubImagePlugin.py
index e232f90db..7125751bd 100644
--- a/PIL/GribStubImagePlugin.py
+++ b/PIL/GribStubImagePlugin.py
@@ -9,7 +9,7 @@
# See the README file for information on usage and redistribution.
#
-import Image, ImageFile
+from . import Image, ImageFile
_handler = None
diff --git a/PIL/Hdf5StubImagePlugin.py b/PIL/Hdf5StubImagePlugin.py
index bc5e37433..d4b1f7932 100644
--- a/PIL/Hdf5StubImagePlugin.py
+++ b/PIL/Hdf5StubImagePlugin.py
@@ -9,7 +9,7 @@
# See the README file for information on usage and redistribution.
#
-import Image, ImageFile
+from . import Image, ImageFile
_handler = None
diff --git a/PIL/IcnsImagePlugin.py b/PIL/IcnsImagePlugin.py
index 5f8ba063b..ac45b99f7 100644
--- a/PIL/IcnsImagePlugin.py
+++ b/PIL/IcnsImagePlugin.py
@@ -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
diff --git a/PIL/IcoImagePlugin.py b/PIL/IcoImagePlugin.py
index 65e2fff26..7549a2771 100644
--- a/PIL/IcoImagePlugin.py
+++ b/PIL/IcoImagePlugin.py
@@ -19,7 +19,7 @@
__version__ = "0.1"
-import Image, BmpImagePlugin
+from . import Image, BmpImagePlugin
#
diff --git a/PIL/ImImagePlugin.py b/PIL/ImImagePlugin.py
index bc4910234..a105ecaef 100644
--- a/PIL/ImImagePlugin.py
+++ b/PIL/ImImagePlugin.py
@@ -29,7 +29,7 @@
__version__ = "0.7"
import re
-import Image, ImageFile, ImagePalette
+from . import Image, ImageFile, ImagePalette
# --------------------------------------------------------------------
diff --git a/PIL/Image.py b/PIL/Image.py
index 50d4e9e54..33154480d 100644
--- a/PIL/Image.py
+++ b/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)
diff --git a/PIL/ImageChops.py b/PIL/ImageChops.py
index 82861fc7a..d37019575 100644
--- a/PIL/ImageChops.py
+++ b/PIL/ImageChops.py
@@ -15,7 +15,7 @@
# See the README file for information on usage and redistribution.
#
-import Image
+from . import Image
##
# The ImageChops module contains a number of arithmetical image
diff --git a/PIL/ImageCms.py b/PIL/ImageCms.py
index ec1eeb7ed..0f2dd0e4d 100644
--- a/PIL/ImageCms.py
+++ b/PIL/ImageCms.py
@@ -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):
diff --git a/PIL/ImageColor.py b/PIL/ImageColor.py
index 8d3354a3c..247a00efc 100644
--- a/PIL/ImageColor.py
+++ b/PIL/ImageColor.py
@@ -17,7 +17,7 @@
# See the README file for information on usage and redistribution.
#
-import Image
+from . import Image
import re
diff --git a/PIL/ImageDraw.py b/PIL/ImageDraw.py
index 5217a7366..d0e735abe 100644
--- a/PIL/ImageDraw.py
+++ b/PIL/ImageDraw.py
@@ -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)
diff --git a/PIL/ImageDraw2.py b/PIL/ImageDraw2.py
index 98cf0c3eb..b453e81d5 100644
--- a/PIL/ImageDraw2.py
+++ b/PIL/ImageDraw2.py
@@ -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):
diff --git a/PIL/ImageEnhance.py b/PIL/ImageEnhance.py
index 86a19e650..767c5ba05 100644
--- a/PIL/ImageEnhance.py
+++ b/PIL/ImageEnhance.py
@@ -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:
diff --git a/PIL/ImageFile.py b/PIL/ImageFile.py
index ef13e5b00..41782d5d6 100644
--- a/PIL/ImageFile.py
+++ b/PIL/ImageFile.py
@@ -27,7 +27,7 @@
# See the README file for information on usage and redistribution.
#
-import Image
+from . import Image
import traceback, os
import io
diff --git a/PIL/ImageFont.py b/PIL/ImageFont.py
index a65881822..939887db2 100644
--- a/PIL/ImageFont.py
+++ b/PIL/ImageFont.py
@@ -27,7 +27,7 @@
from __future__ import print_function
-import Image
+from . import Image
import os, sys
class _imagingft_not_installed:
diff --git a/PIL/ImageGrab.py b/PIL/ImageGrab.py
index 9bcd804d3..f3de6fde4 100644
--- a/PIL/ImageGrab.py
+++ b/PIL/ImageGrab.py
@@ -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 ImageGrab 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
diff --git a/PIL/ImageMath.py b/PIL/ImageMath.py
index 28dd254be..f43501400 100644
--- a/PIL/ImageMath.py
+++ b/PIL/ImageMath.py
@@ -15,7 +15,7 @@
# See the README file for information on usage and redistribution.
#
-import Image
+from . import Image
import _imagingmath
import sys
diff --git a/PIL/ImageMode.py b/PIL/ImageMode.py
index 1d5df1c6d..58daa999e 100644
--- a/PIL/ImageMode.py
+++ b/PIL/ImageMode.py
@@ -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)
diff --git a/PIL/ImageOps.py b/PIL/ImageOps.py
index de32726a1..496631aa9 100644
--- a/PIL/ImageOps.py
+++ b/PIL/ImageOps.py
@@ -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
diff --git a/PIL/ImagePalette.py b/PIL/ImagePalette.py
index a57688b53..b5baf7cbf 100644
--- a/PIL/ImagePalette.py
+++ b/PIL/ImagePalette.py
@@ -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()
diff --git a/PIL/ImagePath.py b/PIL/ImagePath.py
index 721fd9449..fe280ff29 100644
--- a/PIL/ImagePath.py
+++ b/PIL/ImagePath.py
@@ -14,7 +14,7 @@
# See the README file for information on usage and redistribution.
#
-import Image
+from . import Image
##
# Path wrapper.
diff --git a/PIL/ImageQt.py b/PIL/ImageQt.py
index 50ee07d6c..1388dbefa 100644
--- a/PIL/ImageQt.py
+++ b/PIL/ImageQt.py
@@ -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
diff --git a/PIL/ImageShow.py b/PIL/ImageShow.py
index 609c6ee56..a5275def4 100644
--- a/PIL/ImageShow.py
+++ b/PIL/ImageShow.py
@@ -14,7 +14,7 @@
from __future__ import print_function
-import Image
+from . import Image
import os, sys
_viewers = []
diff --git a/PIL/ImageStat.py b/PIL/ImageStat.py
index c87bd57cb..e2e63cabc 100644
--- a/PIL/ImageStat.py
+++ b/PIL/ImageStat.py
@@ -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
diff --git a/PIL/ImageTk.py b/PIL/ImageTk.py
index 6b4311a6b..5563b679f 100644
--- a/PIL/ImageTk.py
+++ b/PIL/ImageTk.py
@@ -25,7 +25,8 @@
# See the README file for information on usage and redistribution.
#
-import Tkinter, Image
+import Tkinter
+from . import Image
##
# The ImageTk module contains support to create and modify
diff --git a/PIL/ImageTransform.py b/PIL/ImageTransform.py
index cc323d3b9..12e3aaa57 100644
--- a/PIL/ImageTransform.py
+++ b/PIL/ImageTransform.py
@@ -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):
diff --git a/PIL/ImageWin.py b/PIL/ImageWin.py
index f98725f74..8e0cd9728 100644
--- a/PIL/ImageWin.py
+++ b/PIL/ImageWin.py
@@ -17,7 +17,7 @@
# See the README file for information on usage and redistribution.
#
-import Image
+from . import Image
##
# The ImageWin module contains support to create and display
diff --git a/PIL/ImtImagePlugin.py b/PIL/ImtImagePlugin.py
index af955deea..853344b24 100644
--- a/PIL/ImtImagePlugin.py
+++ b/PIL/ImtImagePlugin.py
@@ -19,7 +19,7 @@ __version__ = "0.2"
import re
-import Image, ImageFile
+from . import Image, ImageFile
#
# --------------------------------------------------------------------
diff --git a/PIL/IptcImagePlugin.py b/PIL/IptcImagePlugin.py
index ba4b8dcc8..c42df00ae 100644
--- a/PIL/IptcImagePlugin.py
+++ b/PIL/IptcImagePlugin.py
@@ -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
diff --git a/PIL/JpegImagePlugin.py b/PIL/JpegImagePlugin.py
index d7c7f151f..bf1ef4a26 100644
--- a/PIL/JpegImagePlugin.py
+++ b/PIL/JpegImagePlugin.py
@@ -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]
diff --git a/PIL/McIdasImagePlugin.py b/PIL/McIdasImagePlugin.py
index 62ee52cf8..3f77ea198 100644
--- a/PIL/McIdasImagePlugin.py
+++ b/PIL/McIdasImagePlugin.py
@@ -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"
diff --git a/PIL/MicImagePlugin.py b/PIL/MicImagePlugin.py
index f13c28202..b8ee55e06 100644
--- a/PIL/MicImagePlugin.py
+++ b/PIL/MicImagePlugin.py
@@ -20,8 +20,8 @@
__version__ = "0.1"
-import Image, TiffImagePlugin
-from OleFileIO import *
+from . import Image, TiffImagePlugin
+from .OleFileIO import *
#
diff --git a/PIL/MpegImagePlugin.py b/PIL/MpegImagePlugin.py
index 043a5b07b..310cd2363 100644
--- a/PIL/MpegImagePlugin.py
+++ b/PIL/MpegImagePlugin.py
@@ -15,7 +15,7 @@
__version__ = "0.1"
-import Image, ImageFile
+from . import Image, ImageFile
#
# Bitstream parser
diff --git a/PIL/MspImagePlugin.py b/PIL/MspImagePlugin.py
index 8de9f2506..0d9ee1686 100644
--- a/PIL/MspImagePlugin.py
+++ b/PIL/MspImagePlugin.py
@@ -19,7 +19,7 @@
__version__ = "0.1"
-import Image, ImageFile
+from . import Image, ImageFile
#
diff --git a/PIL/PSDraw.py b/PIL/PSDraw.py
index ede863de7..2679b34ca 100644
--- a/PIL/PSDraw.py
+++ b/PIL/PSDraw.py
@@ -17,7 +17,7 @@
from __future__ import print_function
-import EpsImagePlugin
+from . import EpsImagePlugin
##
# Simple Postscript graphics interface.
diff --git a/PIL/PalmImagePlugin.py b/PIL/PalmImagePlugin.py
index 7d26ce6d6..6c6376830 100644
--- a/PIL/PalmImagePlugin.py
+++ b/PIL/PalmImagePlugin.py
@@ -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 ),
diff --git a/PIL/PcdImagePlugin.py b/PIL/PcdImagePlugin.py
index 56d8f1dc0..3c0ba9ed0 100644
--- a/PIL/PcdImagePlugin.py
+++ b/PIL/PcdImagePlugin.py
@@ -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
diff --git a/PIL/PcfFontFile.py b/PIL/PcfFontFile.py
index 0a97a0734..0bc53aa5b 100644
--- a/PIL/PcfFontFile.py
+++ b/PIL/PcfFontFile.py
@@ -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
diff --git a/PIL/PcxImagePlugin.py b/PIL/PcxImagePlugin.py
index a61f248b9..597cc6d9e 100644
--- a/PIL/PcxImagePlugin.py
+++ b/PIL/PcxImagePlugin.py
@@ -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)
diff --git a/PIL/PdfImagePlugin.py b/PIL/PdfImagePlugin.py
index 4f957765c..54b40b0f3 100644
--- a/PIL/PdfImagePlugin.py
+++ b/PIL/PdfImagePlugin.py
@@ -22,7 +22,7 @@
__version__ = "0.4"
-import Image, ImageFile
+from . import Image, ImageFile
import StringIO
diff --git a/PIL/PixarImagePlugin.py b/PIL/PixarImagePlugin.py
index a428977ab..60abd3c12 100644
--- a/PIL/PixarImagePlugin.py
+++ b/PIL/PixarImagePlugin.py
@@ -21,7 +21,7 @@
__version__ = "0.1"
-import Image, ImageFile
+from . import Image, ImageFile
#
# helpers
diff --git a/PIL/PngImagePlugin.py b/PIL/PngImagePlugin.py
index ccdec2829..be9ddcc30 100644
--- a/PIL/PngImagePlugin.py
+++ b/PIL/PngImagePlugin.py
@@ -37,7 +37,8 @@ __version__ = "0.9"
import re
-import Image, ImageFile, ImagePalette, zlib
+from . import Image, ImageFile, ImagePalette
+import zlib
def i16(c):
diff --git a/PIL/PpmImagePlugin.py b/PIL/PpmImagePlugin.py
index a64dc7ae2..7e50f8c67 100644
--- a/PIL/PpmImagePlugin.py
+++ b/PIL/PpmImagePlugin.py
@@ -19,7 +19,7 @@ __version__ = "0.2"
import string
-import Image, ImageFile
+from . import Image, ImageFile
#
# --------------------------------------------------------------------
diff --git a/PIL/PsdImagePlugin.py b/PIL/PsdImagePlugin.py
index 5ef1d808d..0fc07d488 100644
--- a/PIL/PsdImagePlugin.py
+++ b/PIL/PsdImagePlugin.py
@@ -18,7 +18,7 @@
__version__ = "0.4"
-import Image, ImageFile, ImagePalette
+from . import Image, ImageFile, ImagePalette
MODES = {
# (photoshop mode, bits) -> (pil mode, required channels)
diff --git a/PIL/SgiImagePlugin.py b/PIL/SgiImagePlugin.py
index c65b91aca..94b51fc17 100644
--- a/PIL/SgiImagePlugin.py
+++ b/PIL/SgiImagePlugin.py
@@ -21,7 +21,7 @@
__version__ = "0.2"
-import Image, ImageFile
+from . import Image, ImageFile
def i16(c):
diff --git a/PIL/SpiderImagePlugin.py b/PIL/SpiderImagePlugin.py
index ce8cdace6..2b3f4fc20 100644
--- a/PIL/SpiderImagePlugin.py
+++ b/PIL/SpiderImagePlugin.py
@@ -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)
# --------------------------------------------------------------------
diff --git a/PIL/SunImagePlugin.py b/PIL/SunImagePlugin.py
index 37ad4855b..1e03a028e 100644
--- a/PIL/SunImagePlugin.py
+++ b/PIL/SunImagePlugin.py
@@ -20,7 +20,7 @@
__version__ = "0.3"
-import Image, ImageFile, ImagePalette
+from . import Image, ImageFile, ImagePalette
def i16(c):
diff --git a/PIL/TarIO.py b/PIL/TarIO.py
index 7d625402f..f56987f6e 100644
--- a/PIL/TarIO.py
+++ b/PIL/TarIO.py
@@ -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
diff --git a/PIL/TgaImagePlugin.py b/PIL/TgaImagePlugin.py
index ce0f8b465..945e8d1e7 100644
--- a/PIL/TgaImagePlugin.py
+++ b/PIL/TgaImagePlugin.py
@@ -19,7 +19,7 @@
__version__ = "0.3"
-import Image, ImageFile, ImagePalette
+from . import Image, ImageFile, ImagePalette
#
diff --git a/PIL/TiffImagePlugin.py b/PIL/TiffImagePlugin.py
index b74bc2455..960430f2f 100644
--- a/PIL/TiffImagePlugin.py
+++ b/PIL/TiffImagePlugin.py
@@ -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=' ')
diff --git a/PIL/WalImageFile.py b/PIL/WalImageFile.py
index b05ea4a19..16c2d90d5 100644
--- a/PIL/WalImageFile.py
+++ b/PIL/WalImageFile.py
@@ -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)
diff --git a/PIL/WmfImagePlugin.py b/PIL/WmfImagePlugin.py
index 5191f1e51..93124be23 100644
--- a/PIL/WmfImagePlugin.py
+++ b/PIL/WmfImagePlugin.py
@@ -17,7 +17,7 @@
__version__ = "0.2"
-import Image, ImageFile
+from . import Image, ImageFile
_handler = None
diff --git a/PIL/XVThumbImagePlugin.py b/PIL/XVThumbImagePlugin.py
index 2c6242ed8..57de388f9 100644
--- a/PIL/XVThumbImagePlugin.py
+++ b/PIL/XVThumbImagePlugin.py
@@ -19,7 +19,7 @@
__version__ = "0.1"
-import Image, ImageFile, ImagePalette
+from . import Image, ImageFile, ImagePalette
# standard color palette for thumbnails (RGB332)
PALETTE = ""
diff --git a/PIL/XbmImagePlugin.py b/PIL/XbmImagePlugin.py
index ef1a42610..1c6bbcbc3 100644
--- a/PIL/XbmImagePlugin.py
+++ b/PIL/XbmImagePlugin.py
@@ -22,7 +22,7 @@
__version__ = "0.6"
import re
-import Image, ImageFile
+from . import Image, ImageFile
# XBM header
xbm_head = re.compile(
diff --git a/PIL/XpmImagePlugin.py b/PIL/XpmImagePlugin.py
index 10d089e1d..88723529b 100644
--- a/PIL/XpmImagePlugin.py
+++ b/PIL/XpmImagePlugin.py
@@ -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]*)")