mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 17:06:16 +03:00
Replace python-imaging with python-pillow (but yet not Coveralls)
This commit is contained in:
parent
9dc2346dea
commit
c9a4272af6
38
CHANGES.rst
38
CHANGES.rst
|
@ -8,34 +8,34 @@ Changelog (Pillow)
|
||||||
|
|
||||||
- Added tests for Spider files
|
- Added tests for Spider files
|
||||||
[hugovk]
|
[hugovk]
|
||||||
|
|
||||||
- Use libtiff to write any compressed tiff files
|
- Use libtiff to write any compressed tiff files
|
||||||
[wiredfool]
|
[wiredfool]
|
||||||
|
|
||||||
- Support for pickling Image objects
|
- Support for pickling Image objects
|
||||||
[hugovk]
|
[hugovk]
|
||||||
|
|
||||||
- Fixed resolution handling for EPS thumbnails
|
- Fixed resolution handling for EPS thumbnails
|
||||||
[eliempje]
|
[eliempje]
|
||||||
|
|
||||||
- Fixed rendering of some binary EPS files (Issue #302)
|
- Fixed rendering of some binary EPS files (Issue #302)
|
||||||
[eliempje]
|
[eliempje]
|
||||||
|
|
||||||
- Rename variables not to use built-in function names
|
- Rename variables not to use built-in function names
|
||||||
[hugovk]
|
[hugovk]
|
||||||
|
|
||||||
- Ignore junk JPEG markers
|
- Ignore junk JPEG markers
|
||||||
[hugovk]
|
[hugovk]
|
||||||
|
|
||||||
- Change default interpolation for Image.thumbnail to Image.ANTIALIAS
|
- Change default interpolation for Image.thumbnail to Image.ANTIALIAS
|
||||||
[hugovk]
|
[hugovk]
|
||||||
|
|
||||||
- Add tests and fixes for saving PDFs
|
- Add tests and fixes for saving PDFs
|
||||||
[hugovk]
|
[hugovk]
|
||||||
|
|
||||||
- Remove transparency resource after P->RGBA conversion
|
- Remove transparency resource after P->RGBA conversion
|
||||||
[hugovk]
|
[hugovk]
|
||||||
|
|
||||||
- Clean up preprocessor cruft for Windows
|
- Clean up preprocessor cruft for Windows
|
||||||
[CounterPillow]
|
[CounterPillow]
|
||||||
|
|
||||||
|
@ -45,13 +45,13 @@ Changelog (Pillow)
|
||||||
- Added Image.close, context manager support.
|
- Added Image.close, context manager support.
|
||||||
[wiredfool]
|
[wiredfool]
|
||||||
|
|
||||||
- Added support for 16 bit PGM files.
|
- Added support for 16 bit PGM files.
|
||||||
[wiredfool]
|
[wiredfool]
|
||||||
|
|
||||||
- Updated OleFileIO to version 0.30 from upstream
|
- Updated OleFileIO to version 0.30 from upstream
|
||||||
[hugovk]
|
[hugovk]
|
||||||
|
|
||||||
- Added support for additional TIFF floating point format
|
- Added support for additional TIFF floating point format
|
||||||
[Hijackal]
|
[Hijackal]
|
||||||
|
|
||||||
- Have the tempfile use a suffix with a dot
|
- Have the tempfile use a suffix with a dot
|
||||||
|
@ -81,7 +81,7 @@ Changelog (Pillow)
|
||||||
- Added support for JPEG 2000
|
- Added support for JPEG 2000
|
||||||
[al45tair]
|
[al45tair]
|
||||||
|
|
||||||
- Add more detailed error messages to Image.py
|
- Add more detailed error messages to Image.py
|
||||||
[larsmans]
|
[larsmans]
|
||||||
|
|
||||||
- Avoid conflicting _expand functions in PIL & MINGW, fixes #538
|
- Avoid conflicting _expand functions in PIL & MINGW, fixes #538
|
||||||
|
@ -109,7 +109,7 @@ Changelog (Pillow)
|
||||||
[wiredfool]
|
[wiredfool]
|
||||||
|
|
||||||
- Fixed palette handling when converting from mode P->RGB->P
|
- Fixed palette handling when converting from mode P->RGB->P
|
||||||
[d_schmidt]
|
[d_schmidt]
|
||||||
|
|
||||||
- Fixed saving mode P image as a PNG with transparency = palette color 0
|
- Fixed saving mode P image as a PNG with transparency = palette color 0
|
||||||
[d-schmidt]
|
[d-schmidt]
|
||||||
|
@ -119,7 +119,7 @@ Changelog (Pillow)
|
||||||
|
|
||||||
- Fixed DOS with invalid palette size or invalid image size in BMP file
|
- Fixed DOS with invalid palette size or invalid image size in BMP file
|
||||||
[wiredfool]
|
[wiredfool]
|
||||||
|
|
||||||
- Added support for BMP version 4 and 5
|
- Added support for BMP version 4 and 5
|
||||||
[eddwardo, wiredfool]
|
[eddwardo, wiredfool]
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ Changelog (Pillow)
|
||||||
|
|
||||||
- Prefer homebrew freetype over X11 freetype (but still allow both)
|
- Prefer homebrew freetype over X11 freetype (but still allow both)
|
||||||
[dmckeone]
|
[dmckeone]
|
||||||
|
|
||||||
2.3.1 (2014-03-14)
|
2.3.1 (2014-03-14)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ Changelog (Pillow)
|
||||||
[nikmolnar]
|
[nikmolnar]
|
||||||
|
|
||||||
- Fix for encoding of b_whitespace, similar to closed issue #272
|
- Fix for encoding of b_whitespace, similar to closed issue #272
|
||||||
[mhogg]
|
[mhogg]
|
||||||
|
|
||||||
- Fix #273: Add numpy array interface support for 16 and 32 bit integer modes
|
- Fix #273: Add numpy array interface support for 16 and 32 bit integer modes
|
||||||
[cgohlke]
|
[cgohlke]
|
||||||
|
@ -437,7 +437,7 @@ Changelog (Pillow)
|
||||||
- Add Python 3 support. (Pillow >= 2.0.0 supports Python 2.6, 2.7, 3.2, 3.3. Pillow < 2.0.0 supports Python 2.4, 2.5, 2.6, 2.7.)
|
- Add Python 3 support. (Pillow >= 2.0.0 supports Python 2.6, 2.7, 3.2, 3.3. Pillow < 2.0.0 supports Python 2.4, 2.5, 2.6, 2.7.)
|
||||||
[fluggo]
|
[fluggo]
|
||||||
|
|
||||||
- Add PyPy support (experimental, please see: https://github.com/python-imaging/Pillow/issues/67)
|
- Add PyPy support (experimental, please see: https://github.com/python-pillow/Pillow/issues/67)
|
||||||
|
|
||||||
- Add WebP support.
|
- Add WebP support.
|
||||||
[lqs]
|
[lqs]
|
||||||
|
|
|
@ -54,7 +54,7 @@ import collections
|
||||||
import itertools
|
import itertools
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# Set these to true to force use of libtiff for reading or writing.
|
# Set these to true to force use of libtiff for reading or writing.
|
||||||
READ_LIBTIFF = False
|
READ_LIBTIFF = False
|
||||||
WRITE_LIBTIFF= False
|
WRITE_LIBTIFF= False
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ class ImageFileDirectory(collections.MutableMapping):
|
||||||
Value: integer corresponding to the data type from
|
Value: integer corresponding to the data type from
|
||||||
`TiffTags.TYPES`
|
`TiffTags.TYPES`
|
||||||
|
|
||||||
'internal'
|
'internal'
|
||||||
* self.tags = {} Key: numerical tiff tag number
|
* self.tags = {} Key: numerical tiff tag number
|
||||||
Value: Decoded data, Generally a tuple.
|
Value: Decoded data, Generally a tuple.
|
||||||
* If set from __setval__ -- always a tuple
|
* If set from __setval__ -- always a tuple
|
||||||
|
@ -489,10 +489,10 @@ class ImageFileDirectory(collections.MutableMapping):
|
||||||
|
|
||||||
if tag in self.tagtype:
|
if tag in self.tagtype:
|
||||||
typ = self.tagtype[tag]
|
typ = self.tagtype[tag]
|
||||||
|
|
||||||
if Image.DEBUG:
|
if Image.DEBUG:
|
||||||
print ("Tag %s, Type: %s, Value: %s" % (tag, typ, value))
|
print ("Tag %s, Type: %s, Value: %s" % (tag, typ, value))
|
||||||
|
|
||||||
if typ == 1:
|
if typ == 1:
|
||||||
# byte data
|
# byte data
|
||||||
if isinstance(value, tuple):
|
if isinstance(value, tuple):
|
||||||
|
@ -512,7 +512,7 @@ class ImageFileDirectory(collections.MutableMapping):
|
||||||
# and doesn't match the tiff spec: 8-bit byte that
|
# and doesn't match the tiff spec: 8-bit byte that
|
||||||
# contains a 7-bit ASCII code; the last byte must be
|
# contains a 7-bit ASCII code; the last byte must be
|
||||||
# NUL (binary zero). Also, I don't think this was well
|
# NUL (binary zero). Also, I don't think this was well
|
||||||
# excersized before.
|
# excersized before.
|
||||||
data = value = b"" + value.encode('ascii', 'replace') + b"\0"
|
data = value = b"" + value.encode('ascii', 'replace') + b"\0"
|
||||||
else:
|
else:
|
||||||
# integer data
|
# integer data
|
||||||
|
@ -859,7 +859,7 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
# libtiff handles the fillmode for us, so 1;IR should
|
# libtiff handles the fillmode for us, so 1;IR should
|
||||||
# actually be 1;I. Including the R double reverses the
|
# actually be 1;I. Including the R double reverses the
|
||||||
# bits, so stripes of the image are reversed. See
|
# bits, so stripes of the image are reversed. See
|
||||||
# https://github.com/python-imaging/Pillow/issues/279
|
# https://github.com/python-pillow/Pillow/issues/279
|
||||||
if fillorder == 2:
|
if fillorder == 2:
|
||||||
key = (
|
key = (
|
||||||
self.tag.prefix, photo, format, 1,
|
self.tag.prefix, photo, format, 1,
|
||||||
|
@ -984,11 +984,11 @@ def _save(im, fp, filename):
|
||||||
|
|
||||||
compression = im.encoderinfo.get('compression',im.info.get('compression','raw'))
|
compression = im.encoderinfo.get('compression',im.info.get('compression','raw'))
|
||||||
|
|
||||||
libtiff = WRITE_LIBTIFF or compression != 'raw'
|
libtiff = WRITE_LIBTIFF or compression != 'raw'
|
||||||
|
|
||||||
# required for color libtiff images
|
# required for color libtiff images
|
||||||
ifd[PLANAR_CONFIGURATION] = getattr(im, '_planar_configuration', 1)
|
ifd[PLANAR_CONFIGURATION] = getattr(im, '_planar_configuration', 1)
|
||||||
|
|
||||||
# -- multi-page -- skip TIFF header on subsequent pages
|
# -- multi-page -- skip TIFF header on subsequent pages
|
||||||
if not libtiff and fp.tell() == 0:
|
if not libtiff and fp.tell() == 0:
|
||||||
# tiff header (write via IFD to get everything right)
|
# tiff header (write via IFD to get everything right)
|
||||||
|
@ -1025,7 +1025,7 @@ def _save(im, fp, filename):
|
||||||
# which support profiles as TIFF) -- 2008-06-06 Florian Hoech
|
# which support profiles as TIFF) -- 2008-06-06 Florian Hoech
|
||||||
if "icc_profile" in im.info:
|
if "icc_profile" in im.info:
|
||||||
ifd[ICCPROFILE] = im.info["icc_profile"]
|
ifd[ICCPROFILE] = im.info["icc_profile"]
|
||||||
|
|
||||||
if "description" in im.encoderinfo:
|
if "description" in im.encoderinfo:
|
||||||
ifd[IMAGEDESCRIPTION] = im.encoderinfo["description"]
|
ifd[IMAGEDESCRIPTION] = im.encoderinfo["description"]
|
||||||
if "resolution" in im.encoderinfo:
|
if "resolution" in im.encoderinfo:
|
||||||
|
@ -1091,7 +1091,7 @@ def _save(im, fp, filename):
|
||||||
|
|
||||||
blocklist = [STRIPOFFSETS, STRIPBYTECOUNTS, ROWSPERSTRIP, ICCPROFILE] # ICC Profile crashes.
|
blocklist = [STRIPOFFSETS, STRIPBYTECOUNTS, ROWSPERSTRIP, ICCPROFILE] # ICC Profile crashes.
|
||||||
atts={}
|
atts={}
|
||||||
# bits per sample is a single short in the tiff directory, not a list.
|
# bits per sample is a single short in the tiff directory, not a list.
|
||||||
atts[BITSPERSAMPLE] = bits[0]
|
atts[BITSPERSAMPLE] = bits[0]
|
||||||
# Merge the ones that we have with (optional) more bits from
|
# Merge the ones that we have with (optional) more bits from
|
||||||
# the original file, e.g x,y resolution so that we can
|
# the original file, e.g x,y resolution so that we can
|
||||||
|
|
|
@ -37,7 +37,7 @@ def test_roundtrip():
|
||||||
assert_image_similar(reread.convert('RGB'), im, 50)
|
assert_image_similar(reread.convert('RGB'), im, 50)
|
||||||
|
|
||||||
def test_roundtrip2():
|
def test_roundtrip2():
|
||||||
#see https://github.com/python-imaging/Pillow/issues/403
|
#see https://github.com/python-pillow/Pillow/issues/403
|
||||||
out = tempfile('temp.gif')
|
out = tempfile('temp.gif')
|
||||||
im = Image.open('Images/lena.gif')
|
im = Image.open('Images/lena.gif')
|
||||||
im2 = im.copy()
|
im2 = im.copy()
|
||||||
|
@ -48,11 +48,11 @@ def test_roundtrip2():
|
||||||
|
|
||||||
|
|
||||||
def test_palette_handling():
|
def test_palette_handling():
|
||||||
# see https://github.com/python-imaging/Pillow/issues/513
|
# see https://github.com/python-pillow/Pillow/issues/513
|
||||||
|
|
||||||
im = Image.open('Images/lena.gif')
|
im = Image.open('Images/lena.gif')
|
||||||
im = im.convert('RGB')
|
im = im.convert('RGB')
|
||||||
|
|
||||||
im = im.resize((100,100), Image.ANTIALIAS)
|
im = im.resize((100,100), Image.ANTIALIAS)
|
||||||
im2 = im.convert('P', palette=Image.ADAPTIVE, colors=256)
|
im2 = im.convert('P', palette=Image.ADAPTIVE, colors=256)
|
||||||
|
|
||||||
|
@ -60,11 +60,11 @@ def test_palette_handling():
|
||||||
im2.save(f, optimize=True)
|
im2.save(f, optimize=True)
|
||||||
|
|
||||||
reloaded = Image.open(f)
|
reloaded = Image.open(f)
|
||||||
|
|
||||||
assert_image_similar(im, reloaded.convert('RGB'), 10)
|
assert_image_similar(im, reloaded.convert('RGB'), 10)
|
||||||
|
|
||||||
def test_palette_434():
|
def test_palette_434():
|
||||||
# see https://github.com/python-imaging/Pillow/issues/434
|
# see https://github.com/python-pillow/Pillow/issues/434
|
||||||
|
|
||||||
def roundtrip(im, *args, **kwargs):
|
def roundtrip(im, *args, **kwargs):
|
||||||
out = tempfile('temp.gif')
|
out = tempfile('temp.gif')
|
||||||
|
@ -78,10 +78,10 @@ def test_palette_434():
|
||||||
|
|
||||||
assert_image_equal(*roundtrip(im))
|
assert_image_equal(*roundtrip(im))
|
||||||
assert_image_equal(*roundtrip(im, optimize=True))
|
assert_image_equal(*roundtrip(im, optimize=True))
|
||||||
|
|
||||||
im = im.convert("RGB")
|
im = im.convert("RGB")
|
||||||
# check automatic P conversion
|
# check automatic P conversion
|
||||||
reloaded = roundtrip(im)[1].convert('RGB')
|
reloaded = roundtrip(im)[1].convert('RGB')
|
||||||
assert_image_equal(im, reloaded)
|
assert_image_equal(im, reloaded)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ def test_optimize():
|
||||||
|
|
||||||
|
|
||||||
def test_optimize_large_buffer():
|
def test_optimize_large_buffer():
|
||||||
# https://github.com/python-imaging/Pillow/issues/148
|
# https://github.com/python-pillow/Pillow/issues/148
|
||||||
f = tempfile('temp.jpg')
|
f = tempfile('temp.jpg')
|
||||||
# this requires ~ 1.5x Image.MAXBLOCK
|
# this requires ~ 1.5x Image.MAXBLOCK
|
||||||
im = Image.new("RGB", (4096, 4096), 0xff3333)
|
im = Image.new("RGB", (4096, 4096), 0xff3333)
|
||||||
|
@ -159,7 +159,7 @@ def test_progressive_large_buffer_highest_quality():
|
||||||
|
|
||||||
|
|
||||||
def test_large_exif():
|
def test_large_exif():
|
||||||
# https://github.com/python-imaging/Pillow/issues/148
|
# https://github.com/python-pillow/Pillow/issues/148
|
||||||
f = tempfile('temp.jpg')
|
f = tempfile('temp.jpg')
|
||||||
im = lena()
|
im = lena()
|
||||||
im.save(f, 'JPEG', quality=90, exif=b"1"*65532)
|
im.save(f, 'JPEG', quality=90, exif=b"1"*65532)
|
||||||
|
@ -231,7 +231,7 @@ def test_quality_keep():
|
||||||
|
|
||||||
|
|
||||||
def test_junk_jpeg_header():
|
def test_junk_jpeg_header():
|
||||||
# https://github.com/python-imaging/Pillow/issues/630
|
# https://github.com/python-pillow/Pillow/issues/630
|
||||||
filename = "Tests/images/junk_jpeg_header.jpg"
|
filename = "Tests/images/junk_jpeg_header.jpg"
|
||||||
assert_no_exception(lambda: Image.open(filename))
|
assert_no_exception(lambda: Image.open(filename))
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ def test_g4_eq_png():
|
||||||
|
|
||||||
assert_image_equal(g4, png)
|
assert_image_equal(g4, png)
|
||||||
|
|
||||||
# see https://github.com/python-imaging/Pillow/issues/279
|
# see https://github.com/python-pillow/Pillow/issues/279
|
||||||
def test_g4_fillorder_eq_png():
|
def test_g4_fillorder_eq_png():
|
||||||
""" Checking that we're actually getting the data that we expect"""
|
""" Checking that we're actually getting the data that we expect"""
|
||||||
png = Image.open('Tests/images/g4-fillorder-test.png')
|
png = Image.open('Tests/images/g4-fillorder-test.png')
|
||||||
|
@ -96,7 +96,7 @@ def test_g4_write():
|
||||||
assert_equal(reread.info['compression'], 'group4')
|
assert_equal(reread.info['compression'], 'group4')
|
||||||
|
|
||||||
assert_equal(reread.info['compression'], orig.info['compression'])
|
assert_equal(reread.info['compression'], orig.info['compression'])
|
||||||
|
|
||||||
assert_false(orig.tobytes() == reread.tobytes())
|
assert_false(orig.tobytes() == reread.tobytes())
|
||||||
|
|
||||||
def test_adobe_deflate_tiff():
|
def test_adobe_deflate_tiff():
|
||||||
|
@ -120,7 +120,7 @@ def test_write_metadata():
|
||||||
original = img.tag.named()
|
original = img.tag.named()
|
||||||
reloaded = loaded.tag.named()
|
reloaded = loaded.tag.named()
|
||||||
|
|
||||||
# PhotometricInterpretation is set from SAVE_INFO, not the original image.
|
# PhotometricInterpretation is set from SAVE_INFO, not the original image.
|
||||||
ignored = ['StripByteCounts', 'RowsPerStrip', 'PageNumber', 'PhotometricInterpretation']
|
ignored = ['StripByteCounts', 'RowsPerStrip', 'PageNumber', 'PhotometricInterpretation']
|
||||||
|
|
||||||
for tag, value in reloaded.items():
|
for tag, value in reloaded.items():
|
||||||
|
@ -133,7 +133,7 @@ def test_write_metadata():
|
||||||
assert_equal(original[tag], value, "%s didn't roundtrip" % tag)
|
assert_equal(original[tag], value, "%s didn't roundtrip" % tag)
|
||||||
|
|
||||||
for tag, value in original.items():
|
for tag, value in original.items():
|
||||||
if tag not in ignored:
|
if tag not in ignored:
|
||||||
if tag.endswith('Resolution'):
|
if tag.endswith('Resolution'):
|
||||||
val = reloaded[tag]
|
val = reloaded[tag]
|
||||||
assert_almost_equal(val[0][0]/val[0][1], value[0][0]/value[0][1],
|
assert_almost_equal(val[0][0]/val[0][1], value[0][0]/value[0][1],
|
||||||
|
@ -164,7 +164,7 @@ def test_little_endian():
|
||||||
else:
|
else:
|
||||||
assert_equal(b[0], b'\xe0')
|
assert_equal(b[0], b'\xe0')
|
||||||
assert_equal(b[1], b'\x01')
|
assert_equal(b[1], b'\x01')
|
||||||
|
|
||||||
|
|
||||||
out = tempfile("temp.tif")
|
out = tempfile("temp.tif")
|
||||||
#out = "temp.le.tif"
|
#out = "temp.le.tif"
|
||||||
|
@ -174,8 +174,8 @@ def test_little_endian():
|
||||||
assert_equal(reread.info['compression'], im.info['compression'])
|
assert_equal(reread.info['compression'], im.info['compression'])
|
||||||
assert_equal(reread.getpixel((0,0)), 480)
|
assert_equal(reread.getpixel((0,0)), 480)
|
||||||
# UNDONE - libtiff defaults to writing in native endian, so
|
# UNDONE - libtiff defaults to writing in native endian, so
|
||||||
# on big endian, we'll get back mode = 'I;16B' here.
|
# on big endian, we'll get back mode = 'I;16B' here.
|
||||||
|
|
||||||
def test_big_endian():
|
def test_big_endian():
|
||||||
im = Image.open('Tests/images/16bit.MM.deflate.tif')
|
im = Image.open('Tests/images/16bit.MM.deflate.tif')
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ def test_big_endian():
|
||||||
else:
|
else:
|
||||||
assert_equal(b[0], b'\x01')
|
assert_equal(b[0], b'\x01')
|
||||||
assert_equal(b[1], b'\xe0')
|
assert_equal(b[1], b'\xe0')
|
||||||
|
|
||||||
out = tempfile("temp.tif")
|
out = tempfile("temp.tif")
|
||||||
im.save(out)
|
im.save(out)
|
||||||
reread = Image.open(out)
|
reread = Image.open(out)
|
||||||
|
@ -203,12 +203,12 @@ def test_g4_string_info():
|
||||||
"""Tests String data in info directory"""
|
"""Tests String data in info directory"""
|
||||||
file = "Tests/images/lena_g4_500.tif"
|
file = "Tests/images/lena_g4_500.tif"
|
||||||
orig = Image.open(file)
|
orig = Image.open(file)
|
||||||
|
|
||||||
out = tempfile("temp.tif")
|
out = tempfile("temp.tif")
|
||||||
|
|
||||||
orig.tag[269] = 'temp.tif'
|
orig.tag[269] = 'temp.tif'
|
||||||
orig.save(out)
|
orig.save(out)
|
||||||
|
|
||||||
reread = Image.open(out)
|
reread = Image.open(out)
|
||||||
assert_equal('temp.tif', reread.tag[269])
|
assert_equal('temp.tif', reread.tag[269])
|
||||||
|
|
||||||
|
@ -223,8 +223,8 @@ def test_12bit_rawmode():
|
||||||
# convert 12bit.cropped.tif -depth 16 tmp.tif
|
# convert 12bit.cropped.tif -depth 16 tmp.tif
|
||||||
# convert tmp.tif -evaluate RightShift 4 12in16bit2.tif
|
# convert tmp.tif -evaluate RightShift 4 12in16bit2.tif
|
||||||
# imagemagick will auto scale so that a 12bit FFF is 16bit FFF0,
|
# imagemagick will auto scale so that a 12bit FFF is 16bit FFF0,
|
||||||
# so we need to unshift so that the integer values are the same.
|
# so we need to unshift so that the integer values are the same.
|
||||||
|
|
||||||
im2 = Image.open('Tests/images/12in16bit.tif')
|
im2 = Image.open('Tests/images/12in16bit.tif')
|
||||||
|
|
||||||
if Image.DEBUG:
|
if Image.DEBUG:
|
||||||
|
@ -235,11 +235,11 @@ def test_12bit_rawmode():
|
||||||
print (im2.getpixel((0,0)))
|
print (im2.getpixel((0,0)))
|
||||||
print (im2.getpixel((0,1)))
|
print (im2.getpixel((0,1)))
|
||||||
print (im2.getpixel((0,2)))
|
print (im2.getpixel((0,2)))
|
||||||
|
|
||||||
assert_image_equal(im, im2)
|
assert_image_equal(im, im2)
|
||||||
|
|
||||||
def test_blur():
|
def test_blur():
|
||||||
# test case from irc, how to do blur on b/w image and save to compressed tif.
|
# test case from irc, how to do blur on b/w image and save to compressed tif.
|
||||||
from PIL import ImageFilter
|
from PIL import ImageFilter
|
||||||
out = tempfile('temp.tif')
|
out = tempfile('temp.tif')
|
||||||
im = Image.open('Tests/images/pport_g4.tif')
|
im = Image.open('Tests/images/pport_g4.tif')
|
||||||
|
@ -266,7 +266,7 @@ def test_compressions():
|
||||||
im.save(out, compression='jpeg')
|
im.save(out, compression='jpeg')
|
||||||
im2 = Image.open(out)
|
im2 = Image.open(out)
|
||||||
assert_image_similar(im, im2, 30)
|
assert_image_similar(im, im2, 30)
|
||||||
|
|
||||||
|
|
||||||
def test_cmyk_save():
|
def test_cmyk_save():
|
||||||
im = lena('CMYK')
|
im = lena('CMYK')
|
||||||
|
@ -280,7 +280,7 @@ def xtest_bw_compression_wRGB():
|
||||||
""" This test passes, but when running all tests causes a failure due to
|
""" This test passes, but when running all tests causes a failure due to
|
||||||
output on stderr from the error thrown by libtiff. We need to capture that
|
output on stderr from the error thrown by libtiff. We need to capture that
|
||||||
but not now"""
|
but not now"""
|
||||||
|
|
||||||
im = lena('RGB')
|
im = lena('RGB')
|
||||||
out = tempfile('temp.tif')
|
out = tempfile('temp.tif')
|
||||||
|
|
||||||
|
@ -293,8 +293,8 @@ def test_fp_leak():
|
||||||
fn = im.fp.fileno()
|
fn = im.fp.fileno()
|
||||||
|
|
||||||
assert_no_exception(lambda: os.fstat(fn))
|
assert_no_exception(lambda: os.fstat(fn))
|
||||||
im.load() # this should close it.
|
im.load() # this should close it.
|
||||||
assert_exception(OSError, lambda: os.fstat(fn))
|
assert_exception(OSError, lambda: os.fstat(fn))
|
||||||
im = None # this should force even more closed.
|
im = None # this should force even more closed.
|
||||||
assert_exception(OSError, lambda: os.fstat(fn))
|
assert_exception(OSError, lambda: os.fstat(fn))
|
||||||
assert_exception(OSError, lambda: os.close(fn))
|
assert_exception(OSError, lambda: os.close(fn))
|
||||||
|
|
|
@ -101,7 +101,7 @@ def test_bad_text():
|
||||||
assert_equal(im.info, {'spam': 'egg\x00'})
|
assert_equal(im.info, {'spam': 'egg\x00'})
|
||||||
|
|
||||||
def test_bad_ztxt():
|
def test_bad_ztxt():
|
||||||
# Test reading malformed zTXt chunks (python-imaging/Pillow#318)
|
# Test reading malformed zTXt chunks (python-pillow/Pillow#318)
|
||||||
|
|
||||||
im = load(HEAD + chunk(b'zTXt') + TAIL)
|
im = load(HEAD + chunk(b'zTXt') + TAIL)
|
||||||
assert_equal(im.info, {})
|
assert_equal(im.info, {})
|
||||||
|
@ -182,7 +182,7 @@ def test_save_l_transparency():
|
||||||
file = tempfile("temp.png")
|
file = tempfile("temp.png")
|
||||||
assert_no_exception(lambda: im.save(file))
|
assert_no_exception(lambda: im.save(file))
|
||||||
|
|
||||||
# There are 559 transparent pixels.
|
# There are 559 transparent pixels.
|
||||||
im = im.convert('RGBA')
|
im = im.convert('RGBA')
|
||||||
assert_equal(im.split()[3].getcolors()[0][0], 559)
|
assert_equal(im.split()[3].getcolors()[0][0], 559)
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ def test_trns_p():
|
||||||
# Check writing a transparency of 0, issue #528
|
# Check writing a transparency of 0, issue #528
|
||||||
im = lena('P')
|
im = lena('P')
|
||||||
im.info['transparency']=0
|
im.info['transparency']=0
|
||||||
|
|
||||||
f = tempfile("temp.png")
|
f = tempfile("temp.png")
|
||||||
im.save(f)
|
im.save(f)
|
||||||
|
|
||||||
|
@ -263,8 +263,8 @@ def test_trns_p():
|
||||||
assert_true('transparency' in im2.info)
|
assert_true('transparency' in im2.info)
|
||||||
|
|
||||||
assert_image_equal(im2.convert('RGBA'), im.convert('RGBA'))
|
assert_image_equal(im2.convert('RGBA'), im.convert('RGBA'))
|
||||||
|
|
||||||
|
|
||||||
def test_save_icc_profile_none():
|
def test_save_icc_profile_none():
|
||||||
# check saving files with an ICC profile set to None (omit profile)
|
# check saving files with an ICC profile set to None (omit profile)
|
||||||
in_file = "Tests/images/icc_profile_none.png"
|
in_file = "Tests/images/icc_profile_none.png"
|
||||||
|
|
|
@ -6,9 +6,9 @@ tag_ids = dict(zip(TiffTags.TAGS.values(), TiffTags.TAGS.keys()))
|
||||||
def test_rt_metadata():
|
def test_rt_metadata():
|
||||||
""" Test writing arbitray metadata into the tiff image directory
|
""" Test writing arbitray metadata into the tiff image directory
|
||||||
Use case is ImageJ private tags, one numeric, one arbitrary
|
Use case is ImageJ private tags, one numeric, one arbitrary
|
||||||
data. https://github.com/python-imaging/Pillow/issues/291
|
data. https://github.com/python-pillow/Pillow/issues/291
|
||||||
"""
|
"""
|
||||||
|
|
||||||
img = lena()
|
img = lena()
|
||||||
|
|
||||||
textdata = "This is some arbitrary metadata for a text field"
|
textdata = "This is some arbitrary metadata for a text field"
|
||||||
|
@ -20,15 +20,15 @@ def test_rt_metadata():
|
||||||
f = tempfile("temp.tif")
|
f = tempfile("temp.tif")
|
||||||
|
|
||||||
img.save(f, tiffinfo=info)
|
img.save(f, tiffinfo=info)
|
||||||
|
|
||||||
loaded = Image.open(f)
|
loaded = Image.open(f)
|
||||||
|
|
||||||
assert_equal(loaded.tag[50838], (len(textdata),))
|
assert_equal(loaded.tag[50838], (len(textdata),))
|
||||||
assert_equal(loaded.tag[50839], textdata)
|
assert_equal(loaded.tag[50839], textdata)
|
||||||
|
|
||||||
def test_read_metadata():
|
def test_read_metadata():
|
||||||
img = Image.open('Tests/images/lena_g4.tif')
|
img = Image.open('Tests/images/lena_g4.tif')
|
||||||
|
|
||||||
known = {'YResolution': ((1207959552, 16777216),),
|
known = {'YResolution': ((1207959552, 16777216),),
|
||||||
'PlanarConfiguration': (1,),
|
'PlanarConfiguration': (1,),
|
||||||
'BitsPerSample': (1,),
|
'BitsPerSample': (1,),
|
||||||
|
@ -48,7 +48,7 @@ def test_read_metadata():
|
||||||
'StripOffsets': (8,),
|
'StripOffsets': (8,),
|
||||||
'Software': 'ImageMagick 6.5.7-8 2012-08-17 Q16 http://www.imagemagick.org'}
|
'Software': 'ImageMagick 6.5.7-8 2012-08-17 Q16 http://www.imagemagick.org'}
|
||||||
|
|
||||||
# assert_equal is equivalent, but less helpful in telling what's wrong.
|
# assert_equal is equivalent, but less helpful in telling what's wrong.
|
||||||
named = img.tag.named()
|
named = img.tag.named()
|
||||||
for tag, value in named.items():
|
for tag, value in named.items():
|
||||||
assert_equal(known[tag], value)
|
assert_equal(known[tag], value)
|
||||||
|
@ -70,11 +70,11 @@ def test_write_metadata():
|
||||||
reloaded = loaded.tag.named()
|
reloaded = loaded.tag.named()
|
||||||
|
|
||||||
ignored = ['StripByteCounts', 'RowsPerStrip', 'PageNumber', 'StripOffsets']
|
ignored = ['StripByteCounts', 'RowsPerStrip', 'PageNumber', 'StripOffsets']
|
||||||
|
|
||||||
for tag, value in reloaded.items():
|
for tag, value in reloaded.items():
|
||||||
if tag not in ignored:
|
if tag not in ignored:
|
||||||
assert_equal(original[tag], value, "%s didn't roundtrip" % tag)
|
assert_equal(original[tag], value, "%s didn't roundtrip" % tag)
|
||||||
|
|
||||||
for tag, value in original.items():
|
for tag, value in original.items():
|
||||||
if tag not in ignored:
|
if tag not in ignored:
|
||||||
assert_equal(value, reloaded[tag], "%s didn't roundtrip" % tag)
|
assert_equal(value, reloaded[tag], "%s didn't roundtrip" % tag)
|
||||||
|
|
|
@ -28,7 +28,7 @@ def test_default():
|
||||||
assert_image(im, "RGB", im.size)
|
assert_image(im, "RGB", im.size)
|
||||||
|
|
||||||
|
|
||||||
# ref https://github.com/python-imaging/Pillow/issues/274
|
# ref https://github.com/python-pillow/Pillow/issues/274
|
||||||
|
|
||||||
def _test_float_conversion(im):
|
def _test_float_conversion(im):
|
||||||
orig = im.getpixel((5, 5))
|
orig = im.getpixel((5, 5))
|
||||||
|
@ -76,7 +76,7 @@ def test_trns_p():
|
||||||
assert_no_exception(lambda: rgb.save(f))
|
assert_no_exception(lambda: rgb.save(f))
|
||||||
|
|
||||||
|
|
||||||
# ref https://github.com/python-imaging/Pillow/issues/664
|
# ref https://github.com/python-pillow/Pillow/issues/664
|
||||||
|
|
||||||
def test_trns_p_rgba():
|
def test_trns_p_rgba():
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
|
@ -16,27 +16,27 @@ def color(mode):
|
||||||
def check(mode, c=None):
|
def check(mode, c=None):
|
||||||
if not c:
|
if not c:
|
||||||
c = color(mode)
|
c = color(mode)
|
||||||
|
|
||||||
#check putpixel
|
#check putpixel
|
||||||
im = Image.new(mode, (1, 1), None)
|
im = Image.new(mode, (1, 1), None)
|
||||||
im.putpixel((0, 0), c)
|
im.putpixel((0, 0), c)
|
||||||
assert_equal(im.getpixel((0, 0)), c,
|
assert_equal(im.getpixel((0, 0)), c,
|
||||||
"put/getpixel roundtrip failed for mode %s, color %s" %
|
"put/getpixel roundtrip failed for mode %s, color %s" %
|
||||||
(mode, c))
|
(mode, c))
|
||||||
|
|
||||||
# check inital color
|
# check inital color
|
||||||
im = Image.new(mode, (1, 1), c)
|
im = Image.new(mode, (1, 1), c)
|
||||||
assert_equal(im.getpixel((0, 0)), c,
|
assert_equal(im.getpixel((0, 0)), c,
|
||||||
"initial color failed for mode %s, color %s " %
|
"initial color failed for mode %s, color %s " %
|
||||||
(mode, color))
|
(mode, color))
|
||||||
|
|
||||||
def test_basic():
|
def test_basic():
|
||||||
for mode in ("1", "L", "LA", "I", "I;16", "I;16B", "F",
|
for mode in ("1", "L", "LA", "I", "I;16", "I;16B", "F",
|
||||||
"P", "PA", "RGB", "RGBA", "RGBX", "CMYK","YCbCr"):
|
"P", "PA", "RGB", "RGBA", "RGBX", "CMYK","YCbCr"):
|
||||||
check(mode)
|
check(mode)
|
||||||
|
|
||||||
def test_signedness():
|
def test_signedness():
|
||||||
# see https://github.com/python-imaging/Pillow/issues/452
|
# see https://github.com/python-pillow/Pillow/issues/452
|
||||||
# pixelaccess is using signed int* instead of uint*
|
# pixelaccess is using signed int* instead of uint*
|
||||||
for mode in ("I;16", "I;16B"):
|
for mode in ("I;16", "I;16B"):
|
||||||
check(mode, 2**15-1)
|
check(mode, 2**15-1)
|
||||||
|
@ -44,6 +44,6 @@ def test_signedness():
|
||||||
check(mode, 2**15+1)
|
check(mode, 2**15+1)
|
||||||
check(mode, 2**16-1)
|
check(mode, 2**16-1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ from PIL import Image
|
||||||
|
|
||||||
if hasattr(sys, 'pypy_version_info'):
|
if hasattr(sys, 'pypy_version_info'):
|
||||||
# This takes _forever_ on pypy. Open Bug,
|
# This takes _forever_ on pypy. Open Bug,
|
||||||
# see https://github.com/python-imaging/Pillow/issues/484
|
# see https://github.com/python-pillow/Pillow/issues/484
|
||||||
skip()
|
skip()
|
||||||
|
|
||||||
def test_sanity():
|
def test_sanity():
|
||||||
|
@ -26,7 +26,7 @@ def test_sanity():
|
||||||
|
|
||||||
def test_16bit_lut():
|
def test_16bit_lut():
|
||||||
""" Tests for 16 bit -> 8 bit lut for converting I->L images
|
""" Tests for 16 bit -> 8 bit lut for converting I->L images
|
||||||
see https://github.com/python-imaging/Pillow/issues/440
|
see https://github.com/python-pillow/Pillow/issues/440
|
||||||
"""
|
"""
|
||||||
|
|
||||||
im = lena("I")
|
im = lena("I")
|
||||||
|
|
|
@ -10,9 +10,9 @@ def test_extent():
|
||||||
w//2,h//2), # ul -> lr
|
w//2,h//2), # ul -> lr
|
||||||
Image.BILINEAR)
|
Image.BILINEAR)
|
||||||
|
|
||||||
|
|
||||||
scaled = im.resize((w*2, h*2), Image.BILINEAR).crop((0,0,w,h))
|
scaled = im.resize((w*2, h*2), Image.BILINEAR).crop((0,0,w,h))
|
||||||
|
|
||||||
assert_image_similar(transformed, scaled, 10) # undone -- precision?
|
assert_image_similar(transformed, scaled, 10) # undone -- precision?
|
||||||
|
|
||||||
def test_quad():
|
def test_quad():
|
||||||
|
@ -23,9 +23,9 @@ def test_quad():
|
||||||
(0,0,0,h//2,
|
(0,0,0,h//2,
|
||||||
w//2,h//2,w//2,0), # ul -> ccw around quad
|
w//2,h//2,w//2,0), # ul -> ccw around quad
|
||||||
Image.BILINEAR)
|
Image.BILINEAR)
|
||||||
|
|
||||||
scaled = im.resize((w*2, h*2), Image.BILINEAR).crop((0,0,w,h))
|
scaled = im.resize((w*2, h*2), Image.BILINEAR).crop((0,0,w,h))
|
||||||
|
|
||||||
assert_image_equal(transformed, scaled)
|
assert_image_equal(transformed, scaled)
|
||||||
|
|
||||||
def test_mesh():
|
def test_mesh():
|
||||||
|
@ -48,8 +48,8 @@ def test_mesh():
|
||||||
checker = Image.new('RGBA', im.size)
|
checker = Image.new('RGBA', im.size)
|
||||||
checker.paste(scaled, (0,0))
|
checker.paste(scaled, (0,0))
|
||||||
checker.paste(scaled, (w//2,h//2))
|
checker.paste(scaled, (w//2,h//2))
|
||||||
|
|
||||||
assert_image_equal(transformed, checker)
|
assert_image_equal(transformed, checker)
|
||||||
|
|
||||||
# now, check to see that the extra area is (0,0,0,0)
|
# now, check to see that the extra area is (0,0,0,0)
|
||||||
blank = Image.new('RGBA', (w//2,h//2), (0,0,0,0))
|
blank = Image.new('RGBA', (w//2,h//2), (0,0,0,0))
|
||||||
|
@ -59,34 +59,34 @@ def test_mesh():
|
||||||
|
|
||||||
def _test_alpha_premult(op):
|
def _test_alpha_premult(op):
|
||||||
# create image with half white, half black, with the black half transparent.
|
# create image with half white, half black, with the black half transparent.
|
||||||
# do op,
|
# do op,
|
||||||
# there should be no darkness in the white section.
|
# there should be no darkness in the white section.
|
||||||
im = Image.new('RGBA', (10,10), (0,0,0,0));
|
im = Image.new('RGBA', (10,10), (0,0,0,0));
|
||||||
im2 = Image.new('RGBA', (5,10), (255,255,255,255));
|
im2 = Image.new('RGBA', (5,10), (255,255,255,255));
|
||||||
im.paste(im2, (0,0))
|
im.paste(im2, (0,0))
|
||||||
|
|
||||||
im = op(im, (40,10))
|
im = op(im, (40,10))
|
||||||
im_background = Image.new('RGB', (40,10), (255,255,255))
|
im_background = Image.new('RGB', (40,10), (255,255,255))
|
||||||
im_background.paste(im, (0,0), im)
|
im_background.paste(im, (0,0), im)
|
||||||
|
|
||||||
hist = im_background.histogram()
|
hist = im_background.histogram()
|
||||||
assert_equal(40*10, hist[-1])
|
assert_equal(40*10, hist[-1])
|
||||||
|
|
||||||
|
|
||||||
def test_alpha_premult_resize():
|
def test_alpha_premult_resize():
|
||||||
|
|
||||||
def op (im, sz):
|
def op (im, sz):
|
||||||
return im.resize(sz, Image.LINEAR)
|
return im.resize(sz, Image.LINEAR)
|
||||||
|
|
||||||
_test_alpha_premult(op)
|
_test_alpha_premult(op)
|
||||||
|
|
||||||
def test_alpha_premult_transform():
|
def test_alpha_premult_transform():
|
||||||
|
|
||||||
def op(im, sz):
|
def op(im, sz):
|
||||||
(w,h) = im.size
|
(w,h) = im.size
|
||||||
return im.transform(sz, Image.EXTENT,
|
return im.transform(sz, Image.EXTENT,
|
||||||
(0,0,
|
(0,0,
|
||||||
w,h),
|
w,h),
|
||||||
Image.BILINEAR)
|
Image.BILINEAR)
|
||||||
|
|
||||||
_test_alpha_premult(op)
|
_test_alpha_premult(op)
|
||||||
|
@ -94,7 +94,7 @@ def test_alpha_premult_transform():
|
||||||
|
|
||||||
def test_blank_fill():
|
def test_blank_fill():
|
||||||
# attempting to hit
|
# attempting to hit
|
||||||
# https://github.com/python-imaging/Pillow/issues/254 reported
|
# https://github.com/python-pillow/Pillow/issues/254 reported
|
||||||
#
|
#
|
||||||
# issue is that transforms with transparent overflow area
|
# issue is that transforms with transparent overflow area
|
||||||
# contained junk from previous images, especially on systems with
|
# contained junk from previous images, especially on systems with
|
||||||
|
@ -106,11 +106,11 @@ def test_blank_fill():
|
||||||
#
|
#
|
||||||
# Running by default, but I'd totally understand not doing it in
|
# Running by default, but I'd totally understand not doing it in
|
||||||
# the future
|
# the future
|
||||||
|
|
||||||
foo = [Image.new('RGBA',(1024,1024), (a,a,a,a))
|
|
||||||
for a in range(1,65)]
|
|
||||||
|
|
||||||
# Yeah. Watch some JIT optimize this out.
|
foo = [Image.new('RGBA',(1024,1024), (a,a,a,a))
|
||||||
|
for a in range(1,65)]
|
||||||
|
|
||||||
|
# Yeah. Watch some JIT optimize this out.
|
||||||
foo = None
|
foo = None
|
||||||
|
|
||||||
test_mesh()
|
test_mesh()
|
||||||
|
|
|
@ -49,14 +49,14 @@ def test_parser():
|
||||||
|
|
||||||
if EpsImagePlugin.has_ghostscript():
|
if EpsImagePlugin.has_ghostscript():
|
||||||
im1, im2 = roundtrip("EPS")
|
im1, im2 = roundtrip("EPS")
|
||||||
assert_image_similar(im1, im2.convert('L'),20) # EPS comes back in RGB
|
assert_image_similar(im1, im2.convert('L'),20) # EPS comes back in RGB
|
||||||
|
|
||||||
if "jpeg_encoder" in codecs:
|
if "jpeg_encoder" in codecs:
|
||||||
im1, im2 = roundtrip("JPEG") # lossy compression
|
im1, im2 = roundtrip("JPEG") # lossy compression
|
||||||
assert_image(im1, im2.mode, im2.size)
|
assert_image(im1, im2.mode, im2.size)
|
||||||
|
|
||||||
# XXX Why assert exception and why does it fail?
|
# XXX Why assert exception and why does it fail?
|
||||||
# https://github.com/python-imaging/Pillow/issues/78
|
# https://github.com/python-pillow/Pillow/issues/78
|
||||||
#assert_exception(IOError, lambda: roundtrip("PDF"))
|
#assert_exception(IOError, lambda: roundtrip("PDF"))
|
||||||
|
|
||||||
def test_ico():
|
def test_ico():
|
||||||
|
|
|
@ -3,7 +3,7 @@ from PIL import Image
|
||||||
|
|
||||||
import locale
|
import locale
|
||||||
|
|
||||||
# ref https://github.com/python-imaging/Pillow/issues/272
|
# ref https://github.com/python-pillow/Pillow/issues/272
|
||||||
## on windows, in polish locale:
|
## on windows, in polish locale:
|
||||||
|
|
||||||
## import locale
|
## import locale
|
||||||
|
@ -16,7 +16,7 @@ import locale
|
||||||
## 7
|
## 7
|
||||||
## 160
|
## 160
|
||||||
|
|
||||||
# one of string.whitespace is not freely convertable into ascii.
|
# one of string.whitespace is not freely convertable into ascii.
|
||||||
|
|
||||||
path = "Images/lena.jpg"
|
path = "Images/lena.jpg"
|
||||||
|
|
||||||
|
|
|
@ -83,12 +83,12 @@ def test_16bit():
|
||||||
def test_to_array():
|
def test_to_array():
|
||||||
|
|
||||||
def _to_array(mode, dtype):
|
def _to_array(mode, dtype):
|
||||||
img = lena(mode)
|
img = lena(mode)
|
||||||
np_img = numpy.array(img)
|
np_img = numpy.array(img)
|
||||||
_test_img_equals_nparray(img, np_img)
|
_test_img_equals_nparray(img, np_img)
|
||||||
assert_equal(np_img.dtype, numpy.dtype(dtype))
|
assert_equal(np_img.dtype, numpy.dtype(dtype))
|
||||||
|
|
||||||
|
|
||||||
modes = [("L", 'uint8'),
|
modes = [("L", 'uint8'),
|
||||||
("I", 'int32'),
|
("I", 'int32'),
|
||||||
("F", 'float32'),
|
("F", 'float32'),
|
||||||
|
@ -101,20 +101,20 @@ def test_to_array():
|
||||||
("I;16B", '>u2'),
|
("I;16B", '>u2'),
|
||||||
("I;16L", '<u2'),
|
("I;16L", '<u2'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
for mode in modes:
|
for mode in modes:
|
||||||
assert_no_exception(lambda: _to_array(*mode))
|
assert_no_exception(lambda: _to_array(*mode))
|
||||||
|
|
||||||
|
|
||||||
def test_point_lut():
|
def test_point_lut():
|
||||||
# see https://github.com/python-imaging/Pillow/issues/439
|
# see https://github.com/python-pillow/Pillow/issues/439
|
||||||
|
|
||||||
data = list(range(256))*3
|
data = list(range(256))*3
|
||||||
lut = numpy.array(data, dtype='uint8')
|
lut = numpy.array(data, dtype='uint8')
|
||||||
|
|
||||||
im = lena()
|
im = lena()
|
||||||
|
|
||||||
assert_no_exception(lambda: im.point(lut))
|
assert_no_exception(lambda: im.point(lut))
|
||||||
|
|
||||||
|
|
||||||
|
|
2
docs/_templates/sidebarhelp.html
vendored
2
docs/_templates/sidebarhelp.html
vendored
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
If you've discovered a bug, you can
|
If you've discovered a bug, you can
|
||||||
<a href="https://github.com/python-imaging/Pillow/issues/new">open an issue
|
<a href="https://github.com/python-pillow/Pillow/issues/new">open an issue
|
||||||
on Github</a>.
|
on Github</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ The fork authors' goal is to foster active development of PIL through:
|
||||||
- Regular releases to the `Python Package Index`_
|
- Regular releases to the `Python Package Index`_
|
||||||
- Solicitation for community contributions and involvement on `Image-SIG`_
|
- Solicitation for community contributions and involvement on `Image-SIG`_
|
||||||
|
|
||||||
.. _Travis CI: https://travis-ci.org/python-imaging/Pillow
|
.. _Travis CI: https://travis-ci.org/python-pillow/Pillow
|
||||||
.. _GitHub: https://github.com/python-imaging/Pillow
|
.. _GitHub: https://github.com/python-pillow/Pillow
|
||||||
.. _Python Package Index: https://pypi.python.org/pypi/Pillow
|
.. _Python Package Index: https://pypi.python.org/pypi/Pillow
|
||||||
.. _Image-SIG: http://mail.python.org/mailman/listinfo/image-sig
|
.. _Image-SIG: http://mail.python.org/mailman/listinfo/image-sig
|
||||||
|
|
||||||
|
@ -60,6 +60,6 @@ announcement. So if you still want to support PIL, please
|
||||||
|
|
||||||
.. _report issues here first: https://bitbucket.org/effbot/pil-2009-raclette/issues
|
.. _report issues here first: https://bitbucket.org/effbot/pil-2009-raclette/issues
|
||||||
|
|
||||||
.. _open the corresponding Pillow tickets here: https://github.com/python-imaging/Pillow/issues
|
.. _open the corresponding Pillow tickets here: https://github.com/python-pillow/Pillow/issues
|
||||||
|
|
||||||
Please provide a link to the PIL ticket so we can track the issue(s) upstream.
|
Please provide a link to the PIL ticket so we can track the issue(s) upstream.
|
||||||
|
|
|
@ -4,8 +4,8 @@ Pillow
|
||||||
Pillow is the 'friendly' PIL fork by Alex Clark and Contributors. PIL is the
|
Pillow is the 'friendly' PIL fork by Alex Clark and Contributors. PIL is the
|
||||||
Python Imaging Library by Fredrik Lundh and Contributors.
|
Python Imaging Library by Fredrik Lundh and Contributors.
|
||||||
|
|
||||||
.. image:: https://travis-ci.org/python-imaging/Pillow.svg?branch=master
|
.. image:: https://travis-ci.org/python-pillow/Pillow.svg?branch=master
|
||||||
:target: https://travis-ci.org/python-imaging/Pillow
|
:target: https://travis-ci.org/python-pillow/Pillow
|
||||||
:alt: Travis CI build status
|
:alt: Travis CI build status
|
||||||
|
|
||||||
.. image:: https://pypip.in/v/Pillow/badge.png
|
.. image:: https://pypip.in/v/Pillow/badge.png
|
||||||
|
@ -24,7 +24,7 @@ To start using Pillow, please read the :doc:`installation
|
||||||
instructions <installation>`.
|
instructions <installation>`.
|
||||||
|
|
||||||
You can get the source and contribute at
|
You can get the source and contribute at
|
||||||
https://github.com/python-imaging/Pillow. You can download archives
|
https://github.com/python-pillow/Pillow. You can download archives
|
||||||
and old versions from `PyPI <https://pypi.python.org/pypi/Pillow>`_.
|
and old versions from `PyPI <https://pypi.python.org/pypi/Pillow>`_.
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
|
@ -42,7 +42,7 @@ Support Pillow!
|
||||||
|
|
||||||
PIL needs you! Please help us maintain the Python Imaging Library here:
|
PIL needs you! Please help us maintain the Python Imaging Library here:
|
||||||
|
|
||||||
- `GitHub <https://github.com/python-imaging/Pillow>`_
|
- `GitHub <https://github.com/python-pillow/Pillow>`_
|
||||||
- `Freenode <irc://irc.freenode.net#pil>`_
|
- `Freenode <irc://irc.freenode.net#pil>`_
|
||||||
- `Image-SIG <http://mail.python.org/mailman/listinfo/image-sig>`_
|
- `Image-SIG <http://mail.python.org/mailman/listinfo/image-sig>`_
|
||||||
|
|
||||||
|
|
8
setup.py
8
setup.py
|
@ -234,7 +234,7 @@ class pil_build_ext(build_ext):
|
||||||
elif sys.platform.startswith("linux"):
|
elif sys.platform.startswith("linux"):
|
||||||
arch_tp = (plat.processor(), plat.architecture()[0])
|
arch_tp = (plat.processor(), plat.architecture()[0])
|
||||||
if arch_tp == ("x86_64","32bit"):
|
if arch_tp == ("x86_64","32bit"):
|
||||||
# 32 bit build on 64 bit machine.
|
# 32 bit build on 64 bit machine.
|
||||||
_add_directory(library_dirs, "/usr/lib/i386-linux-gnu")
|
_add_directory(library_dirs, "/usr/lib/i386-linux-gnu")
|
||||||
else:
|
else:
|
||||||
for platform_ in arch_tp:
|
for platform_ in arch_tp:
|
||||||
|
@ -339,7 +339,7 @@ class pil_build_ext(build_ext):
|
||||||
# on Windows, look for the OpenJPEG libraries in the location that
|
# on Windows, look for the OpenJPEG libraries in the location that
|
||||||
# the official installed puts them
|
# the official installed puts them
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
_add_directory(library_dirs,
|
_add_directory(library_dirs,
|
||||||
os.path.join(os.environ.get("ProgramFiles", ""),
|
os.path.join(os.environ.get("ProgramFiles", ""),
|
||||||
"OpenJPEG 2.0", "lib"))
|
"OpenJPEG 2.0", "lib"))
|
||||||
_add_directory(include_dirs,
|
_add_directory(include_dirs,
|
||||||
|
@ -378,7 +378,7 @@ class pil_build_ext(build_ext):
|
||||||
if _find_include_file(self, "openjpeg-2.0/openjpeg.h"):
|
if _find_include_file(self, "openjpeg-2.0/openjpeg.h"):
|
||||||
if _find_library_file(self, "openjp2"):
|
if _find_library_file(self, "openjp2"):
|
||||||
feature.jpeg2000 = "openjp2"
|
feature.jpeg2000 = "openjp2"
|
||||||
|
|
||||||
if feature.want('tiff'):
|
if feature.want('tiff'):
|
||||||
if _find_library_file(self, "tiff"):
|
if _find_library_file(self, "tiff"):
|
||||||
feature.tiff = "tiff"
|
feature.tiff = "tiff"
|
||||||
|
@ -660,7 +660,7 @@ setup(
|
||||||
_read('CHANGES.rst')).decode('utf-8'),
|
_read('CHANGES.rst')).decode('utf-8'),
|
||||||
author='Alex Clark (fork author)',
|
author='Alex Clark (fork author)',
|
||||||
author_email='aclark@aclark.net',
|
author_email='aclark@aclark.net',
|
||||||
url='http://python-imaging.github.io/',
|
url='http://python-pillow.github.io/',
|
||||||
classifiers=[
|
classifiers=[
|
||||||
"Development Status :: 6 - Mature",
|
"Development Status :: 6 - Mature",
|
||||||
"Topic :: Multimedia :: Graphics",
|
"Topic :: Multimedia :: Graphics",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user