mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 02:06:18 +03:00
commit
87bbfd5725
|
@ -24,12 +24,10 @@
|
|||
#
|
||||
|
||||
|
||||
__version__ = "0.7"
|
||||
|
||||
|
||||
from PIL import Image, ImageFile, ImagePalette, _binary
|
||||
import math
|
||||
|
||||
__version__ = "0.7"
|
||||
|
||||
i8 = _binary.i8
|
||||
i16 = _binary.i16le
|
||||
|
|
|
@ -17,10 +17,9 @@
|
|||
#
|
||||
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
from PIL import Image, BmpImagePlugin, _binary
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
|
|
|
@ -21,12 +21,11 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
__version__ = "0.2"
|
||||
|
||||
from PIL import Image, _binary
|
||||
|
||||
from PIL.PcxImagePlugin import PcxImageFile
|
||||
|
||||
__version__ = "0.2"
|
||||
|
||||
MAGIC = 0x3ADE68B1 # QUIZ: what's this value, then?
|
||||
|
||||
i32 = _binary.i32le
|
||||
|
|
|
@ -20,12 +20,13 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
__version__ = "0.5"
|
||||
|
||||
import re
|
||||
import io
|
||||
import sys
|
||||
from PIL import Image, ImageFile, _binary
|
||||
|
||||
__version__ = "0.5"
|
||||
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
|
@ -36,7 +37,6 @@ split = re.compile(r"^%%([^:]*):[ \t]*(.*)[ \t]*$")
|
|||
field = re.compile(r"^%[%!\w]([^:]*)[ \t]*$")
|
||||
|
||||
gs_windows_binary = None
|
||||
import sys
|
||||
if sys.platform.startswith('win'):
|
||||
import shutil
|
||||
if hasattr(shutil, 'which'):
|
||||
|
@ -187,7 +187,8 @@ class PSFile(object):
|
|||
|
||||
|
||||
def _accept(prefix):
|
||||
return prefix[:4] == b"%!PS" or (len(prefix) >= 4 and i32(prefix) == 0xC6D3D0C5)
|
||||
return prefix[:4] == b"%!PS" or \
|
||||
(len(prefix) >= 4 and i32(prefix) == 0xC6D3D0C5)
|
||||
|
||||
##
|
||||
# Image plugin for Encapsulated Postscript. This plugin supports only
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
#
|
||||
|
||||
|
||||
__version__ = "0.2"
|
||||
|
||||
from PIL import Image, ImageFile, ImagePalette, _binary
|
||||
|
||||
__version__ = "0.2"
|
||||
|
||||
i8 = _binary.i8
|
||||
i16 = _binary.i16le
|
||||
i32 = _binary.i32le
|
||||
|
|
|
@ -16,12 +16,11 @@
|
|||
#
|
||||
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
|
||||
from PIL import Image, ImageFile
|
||||
from PIL.OleFileIO import i8, i32, MAGIC, OleFileIO
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
|
||||
# we map from colour field tuples to (mode, rawmode) descriptors
|
||||
MODES = {
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
# purposes only.
|
||||
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
from PIL import ImageFile, ImagePalette, _binary
|
||||
from PIL._util import isPath
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
try:
|
||||
import builtins
|
||||
except ImportError:
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
# * http://msdn.microsoft.com/en-us/library/ms997538.aspx
|
||||
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
import struct
|
||||
from io import BytesIO
|
||||
|
||||
from PIL import Image, ImageFile, BmpImagePlugin, PngImagePlugin, _binary
|
||||
from math import log, ceil
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -26,12 +26,12 @@
|
|||
#
|
||||
|
||||
|
||||
__version__ = "0.7"
|
||||
|
||||
import re
|
||||
from PIL import Image, ImageFile, ImagePalette
|
||||
from PIL._binary import i8
|
||||
|
||||
__version__ = "0.7"
|
||||
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# Standard tags
|
||||
|
|
|
@ -33,7 +33,7 @@ import io
|
|||
import logging
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
# import traceback
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -275,7 +275,8 @@ def truetype(font=None, size=10, index=0, encoding="", filename=None):
|
|||
# According to the freedesktop spec, XDG_DATA_DIRS should
|
||||
# default to /usr/share
|
||||
lindirs = '/usr/share'
|
||||
dirs += [os.path.join(lindir, "fonts") for lindir in lindirs.split(":")]
|
||||
dirs += [os.path.join(lindir, "fonts")
|
||||
for lindir in lindirs.split(":")]
|
||||
elif sys.platform == 'darwin':
|
||||
dirs += ['/Library/Fonts', '/System/Library/Fonts',
|
||||
os.path.expanduser('~/Library/Fonts')]
|
||||
|
|
|
@ -15,12 +15,13 @@
|
|||
#
|
||||
|
||||
|
||||
__version__ = "0.2"
|
||||
|
||||
import re
|
||||
|
||||
from PIL import Image, ImageFile
|
||||
|
||||
__version__ = "0.2"
|
||||
|
||||
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -17,13 +17,12 @@
|
|||
|
||||
from __future__ import print_function
|
||||
|
||||
__version__ = "0.3"
|
||||
|
||||
|
||||
from PIL import Image, ImageFile, _binary
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
__version__ = "0.3"
|
||||
|
||||
i8 = _binary.i8
|
||||
i16 = _binary.i16be
|
||||
i32 = _binary.i32be
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
__version__ = "0.6"
|
||||
|
||||
import array
|
||||
import struct
|
||||
import io
|
||||
|
@ -48,6 +46,8 @@ o8 = _binary.o8
|
|||
i16 = _binary.i16be
|
||||
i32 = _binary.i32be
|
||||
|
||||
__version__ = "0.6"
|
||||
|
||||
|
||||
#
|
||||
# Parser
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
__version__ = "0.2"
|
||||
|
||||
import struct
|
||||
from PIL import Image, ImageFile
|
||||
|
||||
__version__ = "0.2"
|
||||
|
||||
|
||||
def _accept(s):
|
||||
return s[:8] == b"\x00\x00\x00\x00\x00\x00\x00\x04"
|
||||
|
|
|
@ -17,12 +17,11 @@
|
|||
#
|
||||
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
|
||||
from PIL import Image, TiffImagePlugin
|
||||
from PIL.OleFileIO import MAGIC, OleFileIO
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
|
|
|
@ -13,11 +13,12 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
from PIL import Image, ImageFile
|
||||
from PIL._binary import i8
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
|
||||
#
|
||||
# Bitstream parser
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
from PIL import Image, JpegImagePlugin
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
|
||||
def _accept(prefix):
|
||||
return JpegImagePlugin._accept(prefix)
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
#
|
||||
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
from PIL import Image, ImageFile, _binary
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
|
||||
#
|
||||
# read MSP files
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
# Image plugin for Palm pixmap images (output only).
|
||||
##
|
||||
|
||||
__version__ = "1.0"
|
||||
|
||||
from PIL import Image, ImageFile, _binary
|
||||
|
||||
__version__ = "1.0"
|
||||
|
||||
_Palm8BitColormapValues = (
|
||||
(255, 255, 255), (255, 204, 255), (255, 153, 255), (255, 102, 255),
|
||||
(255, 51, 255), (255, 0, 255), (255, 255, 204), (255, 204, 204),
|
||||
|
|
|
@ -15,11 +15,10 @@
|
|||
#
|
||||
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
|
||||
from PIL import Image, ImageFile, _binary
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
i8 = _binary.i8
|
||||
|
||||
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
# Image plugin for PDF images (output only).
|
||||
##
|
||||
|
||||
__version__ = "0.4"
|
||||
|
||||
from PIL import Image, ImageFile
|
||||
from PIL._binary import i8
|
||||
import io
|
||||
|
||||
__version__ = "0.4"
|
||||
|
||||
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
from PIL import Image, ImageFile, _binary
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
#
|
||||
# helpers
|
||||
|
||||
|
|
|
@ -33,14 +33,14 @@
|
|||
|
||||
from __future__ import print_function
|
||||
|
||||
__version__ = "0.9"
|
||||
|
||||
import logging
|
||||
import re
|
||||
import zlib
|
||||
|
||||
from PIL import Image, ImageFile, ImagePalette, _binary
|
||||
|
||||
__version__ = "0.9"
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
i8 = _binary.i8
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
#
|
||||
|
||||
|
||||
__version__ = "0.2"
|
||||
|
||||
import string
|
||||
|
||||
from PIL import Image, ImageFile
|
||||
|
||||
__version__ = "0.2"
|
||||
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -18,11 +18,10 @@
|
|||
#
|
||||
|
||||
|
||||
__version__ = "0.2"
|
||||
|
||||
|
||||
from PIL import Image, ImageFile, _binary
|
||||
|
||||
__version__ = "0.2"
|
||||
|
||||
i8 = _binary.i8
|
||||
i16 = _binary.i16be
|
||||
i32 = _binary.i32be
|
||||
|
|
|
@ -17,11 +17,10 @@
|
|||
#
|
||||
|
||||
|
||||
__version__ = "0.3"
|
||||
|
||||
|
||||
from PIL import Image, ImageFile, ImagePalette, _binary
|
||||
|
||||
__version__ = "0.3"
|
||||
|
||||
i16 = _binary.i16be
|
||||
i32 = _binary.i32be
|
||||
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
#
|
||||
|
||||
|
||||
__version__ = "0.3"
|
||||
|
||||
from PIL import Image, ImageFile, ImagePalette, _binary
|
||||
|
||||
__version__ = "0.3"
|
||||
|
||||
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
|
|
|
@ -41,9 +41,6 @@
|
|||
|
||||
from __future__ import print_function
|
||||
|
||||
__version__ = "1.3.5"
|
||||
DEBUG = False # Needs to be merged with the new logging approach.
|
||||
|
||||
from PIL import Image, ImageFile
|
||||
from PIL import ImagePalette
|
||||
from PIL import _binary
|
||||
|
@ -57,6 +54,9 @@ import itertools
|
|||
import os
|
||||
import io
|
||||
|
||||
__version__ = "1.3.5"
|
||||
DEBUG = False # Needs to be merged with the new logging approach.
|
||||
|
||||
# Set these to true to force use of libtiff for reading or writing.
|
||||
READ_LIBTIFF = False
|
||||
WRITE_LIBTIFF = False
|
||||
|
@ -702,7 +702,8 @@ class TiffImageFile(ImageFile.ImageFile):
|
|||
if not self.__next:
|
||||
raise EOFError("no more images in TIFF file")
|
||||
if DEBUG:
|
||||
print("Seeking to frame %s, on frame %s, __next %s, location: %s" %
|
||||
print("Seeking to frame %s, on frame %s, " +
|
||||
"__next %s, location: %s" %
|
||||
(frame, self.__frame, self.__next, self.fp.tell()))
|
||||
# reset python3 buffered io handle in case fp
|
||||
# was passed to libtiff, invalidating the buffer
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
__version__ = "0.2"
|
||||
|
||||
from PIL import Image, ImageFile, _binary
|
||||
|
||||
__version__ = "0.2"
|
||||
|
||||
_handler = None
|
||||
|
||||
if str != bytes:
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
# FIXME: make save work (this requires quantization support)
|
||||
#
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
from PIL import Image, ImageFile, ImagePalette, _binary
|
||||
|
||||
__version__ = "0.1"
|
||||
|
||||
o8 = _binary.o8
|
||||
|
||||
# standard color palette for thumbnails (RGB332)
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
__version__ = "0.6"
|
||||
|
||||
import re
|
||||
from PIL import Image, ImageFile
|
||||
|
||||
__version__ = "0.6"
|
||||
|
||||
# XBM header
|
||||
xbm_head = re.compile(
|
||||
b"\s*#define[ \t]+.*_width[ \t]+(?P<width>[0-9]+)[\r\n]+"
|
||||
|
|
|
@ -15,13 +15,12 @@
|
|||
#
|
||||
|
||||
|
||||
__version__ = "0.2"
|
||||
|
||||
|
||||
import re
|
||||
from PIL import Image, ImageFile, ImagePalette
|
||||
from PIL._binary import i8, o8
|
||||
|
||||
__version__ = "0.2"
|
||||
|
||||
# XPM header
|
||||
xpm_head = re.compile(b"\"([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*)")
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
|
||||
from __future__ import print_function
|
||||
|
||||
VERSION = "0.4"
|
||||
|
||||
import glob
|
||||
import sys
|
||||
|
||||
|
@ -21,6 +19,8 @@ import sys
|
|||
from PIL import BdfFontFile
|
||||
from PIL import PcfFontFile
|
||||
|
||||
VERSION = "0.4"
|
||||
|
||||
if len(sys.argv) <= 1:
|
||||
print("PILFONT", VERSION, "-- PIL font compiler.")
|
||||
print()
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import sys
|
||||
sys.path.insert(0, ".")
|
||||
|
||||
import helper
|
||||
import timeit
|
||||
|
||||
import sys
|
||||
sys.path.insert(0, ".")
|
||||
|
||||
|
||||
def bench(mode):
|
||||
im = helper.hopper(mode)
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
from __future__ import print_function
|
||||
import sys
|
||||
sys.path.insert(0, ".")
|
||||
|
||||
import glob
|
||||
import os
|
||||
import traceback
|
||||
|
||||
import sys
|
||||
sys.path.insert(0, ".")
|
||||
|
||||
for file in glob.glob("PIL/*.py"):
|
||||
module = os.path.basename(file)[:-3]
|
||||
try:
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import sys
|
||||
sys.path.insert(0, ".")
|
||||
|
||||
from PIL import Image
|
||||
from PIL import ImageCms
|
||||
|
||||
import sys
|
||||
sys.path.insert(0, ".")
|
||||
|
||||
try:
|
||||
filename = sys.argv[1]
|
||||
except IndexError:
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
from __future__ import print_function
|
||||
import sys
|
||||
sys.path.insert(0, ".")
|
||||
|
||||
from PIL import Image
|
||||
from PIL import ImageMath
|
||||
|
||||
import sys
|
||||
sys.path.insert(0, ".")
|
||||
|
||||
try:
|
||||
filename = sys.argv[1]
|
||||
except IndexError:
|
||||
|
|
|
@ -88,7 +88,6 @@ class TestFileTiff(PillowTestCase):
|
|||
self.assertRaises(SyntaxError,
|
||||
lambda: TiffImagePlugin.TiffImageFile(invalid_file))
|
||||
|
||||
|
||||
def test_bad_exif(self):
|
||||
try:
|
||||
Image.open('Tests/images/hopper_bad_exif.jpg')._getexif()
|
||||
|
|
|
@ -5,14 +5,14 @@ from PIL import ImageColor
|
|||
from PIL import ImageDraw
|
||||
import os.path
|
||||
|
||||
import sys
|
||||
|
||||
BLACK = (0, 0, 0)
|
||||
WHITE = (255, 255, 255)
|
||||
GRAY = (190, 190, 190)
|
||||
DEFAULT_MODE = 'RGB'
|
||||
IMAGES_PATH = os.path.join('Tests', 'images', 'imagedraw')
|
||||
|
||||
import sys
|
||||
|
||||
# Image size
|
||||
W, H = 100, 100
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user