Compare commits

...

11 Commits
main ... 3.0.x

Author SHA1 Message Date
wiredfool
7729d88995 Add tag info for iccprofile, fixes #1462 2015-10-10 05:02:16 -07:00
Alex Clark
ea437d36ca Add Zenodo badge for #1322 [ci skip]
Looks like I had to "draft a release" in the GitHub UI to make this work.
2015-10-06 14:37:27 -04:00
wiredfool
93e688cc2b Flatten sampleformat to initial value, fixes #1466 2015-10-03 16:46:34 -07:00
wiredfool
fbfa292204 Fix handling of pathlib in save. Fixes #1460 2015-10-03 16:46:25 -07:00
Alex Clark
8bcc652275 Update AppVeyor URL accordingly [ci skip]
c.f. #1468
2015-10-04 15:41:56 -04:00
Alex Clark
46baaaf2b2 Add AppVeyor badge [ci skip] 2015-10-04 06:53:00 -04:00
Alex Clark
2fa3738244 s/aclark4life/pillow/ [ci skip] 2015-10-04 06:36:17 -04:00
Alex Clark
5a8e6b38a9 Add Gratipay Badge [ci skip]
Note: anyone on the GitHub Pillow Team interested in receiving donations for their contributions may do so via the Gratipay Pillow Team (https://gratipay.com/pillow/). I'm not sure how to add folks, but if you are interested I will figure it out (I'm currently the only recipient.)
2015-10-04 06:34:34 -04:00
Alex Clark
cd0dc67c23 Add docs badge [ci skip]
Because more badges!
2015-10-02 06:30:01 -04:00
Alex Clark
fd005c6fa2 Add docs badge [ci skip]
Because more badges and the same badges duplicated in two places! (Maybe we only need badges in either the README.rst or docs/index.rst? Or maybe just we need to keep duplicating them. Not sure.)
2015-10-02 06:29:48 -04:00
wiredfool
88dbf06820 Update Release Notes [ci skip]
Updated release notes to cover the change to the handling of libjpeg and libz
Update installation.rst formatting
2015-10-02 03:07:20 -07:00
12 changed files with 85 additions and 12 deletions

View File

@ -1620,13 +1620,17 @@ class Image(object):
"""
filename = ""
open_fp = False
if isPath(fp):
filename = fp
open_fp = True
elif sys.version_info >= (3, 4):
from pathlib import Path
if isinstance(fp, Path):
filename = str(fp.resolve())
open_fp = True
elif hasattr(fp, "name") and isPath(fp.name):
# only set the name for metadata purposes
filename = fp.name
# may mutate self!
@ -1655,17 +1659,14 @@ class Image(object):
else:
save_handler = SAVE[format.upper()]
if filename:
if open_fp:
fp = builtins.open(filename, "wb")
close = 1
else:
close = 0
try:
save_handler(self, fp, filename)
finally:
# do what we can to clean up
if close:
if open_fp:
fp.close()
def seek(self, frame):

View File

@ -180,8 +180,6 @@ OPEN_INFO = {
(MM, 2, (1,), 1, (8, 8, 8, 8), (2,)): ("RGBA", "RGBA"),
(II, 2, (1,), 1, (8, 8, 8, 8), (999,)): ("RGBA", "RGBA"), # Corel Draw 10
(MM, 2, (1,), 1, (8, 8, 8, 8), (999,)): ("RGBA", "RGBA"), # Corel Draw 10
(II, 2, (1, 1, 1, 1), 1, (8, 8, 8, 8), (1,)): ("RGBA", "RGBA"), # OSX Grab
(MM, 2, (1, 1, 1, 1), 1, (8, 8, 8, 8), (1,)): ("RGBA", "RGBA"), # OSX Grab
(II, 3, (1,), 1, (1,), ()): ("P", "P;1"),
(MM, 3, (1,), 1, (1,), ()): ("P", "P;1"),
(II, 3, (1,), 2, (1,), ()): ("P", "P;1R"),
@ -967,6 +965,13 @@ class TiffImageFile(ImageFile.ImageFile):
print("- size:", self.size)
format = self.tag_v2.get(SAMPLEFORMAT, (1,))
if len(format) > 1 and max(format) == min(format) == 1:
# SAMPLEFORMAT is properly per band, so an RGB image will
# be (1,1,1). But, we don't support per band pixel types,
# and anything more than one band is a uint8. So, just
# take the first element. Revisit this if adding support
# for more exotic images.
format = (1,)
# mode: check photometric interpretation and bits per pixel
key = (

View File

@ -133,6 +133,7 @@ TAGS_V2 = {
# FIXME add more tags here
34665: ("ExifIFD", 3, 1),
34675: ('ICCProfile', 7, 1),
# MPInfo
45056: ("MPFVersion", 7, 1),
@ -171,7 +172,6 @@ TAGS = {347: 'JPEGTables',
33437: 'FNumber',
33723: 'IptcNaaInfo',
34377: 'PhotoshopInfo',
34675: 'ICCProfile',
34850: 'ExposureProgram',
34852: 'SpectralSensitivity',
34853: 'GPSInfoIFD',

View File

@ -6,6 +6,13 @@ Python Imaging Library (Fork)
Pillow is the friendly PIL fork by `Alex Clark and Contributors <https://github.com/python-pillow/Pillow/graphs/contributors>`_. PIL is the Python Imaging Library by Fredrik Lundh and Contributors.
.. image:: https://zenodo.org/badge/17549/python-pillow/Pillow.svg
:target: https://zenodo.org/badge/latestdoi/17549/python-pillow/Pillow
.. image:: https://readthedocs.org/projects/pillow/badge/?version=latest
:target: http://pillow.readthedocs.org/?badge=latest
:alt: Documentation Status
.. image:: https://img.shields.io/travis/python-pillow/Pillow/master.svg?label=Linux%20build
:target: https://travis-ci.org/python-pillow/Pillow
:alt: Travis CI build status (Linux)
@ -14,8 +21,8 @@ Pillow is the friendly PIL fork by `Alex Clark and Contributors <https://github.
:target: https://travis-ci.org/python-pillow/pillow-wheels
:alt: Travis CI build status (OS X)
.. image:: https://img.shields.io/appveyor/ci/Pythonpillow/pillow/master.svg?label=Windows%20build
:target: https://ci.appveyor.com/project/Pythonpillow/pillow
.. image:: https://img.shields.io/appveyor/ci/python-pillow/Pillow/master.svg?label=Windows%20build
:target: https://ci.appveyor.com/project/python-pillow/Pillow
:alt: AppVeyor CI build status (Windows)
.. image:: https://img.shields.io/pypi/v/pillow.svg
@ -34,6 +41,7 @@ Pillow is the friendly PIL fork by `Alex Clark and Contributors <https://github.
:target: https://landscape.io/github/python-pillow/Pillow/master
:alt: Code health
More Information
----------------
@ -50,3 +58,11 @@ More Information
- `Changelog <https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst>`_
- `Pre-fork <https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst#pre-fork>`_
.. raw:: html
<div style="float: right">
<a href="https://gratipay.com/pillow/">
<img alt="Support via Gratipay" src="https://cdn.rawgit.com/gratipay/gratipay-badge/2.3.0/dist/gratipay.png"/>
</a>
</div>

BIN
Tests/images/copyleft.tiff Normal file

Binary file not shown.

Binary file not shown.

View File

@ -70,6 +70,11 @@ class TestFileTiff(PillowTestCase):
])
im.load()
def test_sampleformat(self):
# https://github.com/python-pillow/Pillow/issues/1466
im = Image.open("Tests/images/copyleft.tiff")
self.assertEqual(im.mode, 'RGB')
def test_xyres_tiff(self):
from PIL.TiffImagePlugin import X_RESOLUTION, Y_RESOLUTION
filename = "Tests/images/pil168.tif"

View File

@ -148,6 +148,17 @@ class TestFileTiffMetadata(PillowTestCase):
except struct.error:
self.fail("Should not be struct errors there.")
def test_iccprofile(self):
# https://github.com/python-pillow/Pillow/issues/1462
im = Image.open('Tests/images/hopper.iccprofile.tif')
out = self.tempfile('temp.tiff')
im.save(out)
reloaded = Image.open(out)
self.assert_(type(im.info['icc_profile']) is not type(tuple))
self.assertEqual(im.info['icc_profile'], reloaded.info['icc_profile'])
if __name__ == '__main__':
unittest.main()

View File

@ -57,6 +57,17 @@ class TestImage(PillowTestCase):
self.assertEqual(im.mode, "RGB")
self.assertEqual(im.size, (128, 128))
def test_tempfile(self):
# see #1460, pathlib support breaks tempfile.TemporaryFile on py27
# Will error out on save on 3.0.0
import tempfile
im = hopper()
fp = tempfile.TemporaryFile()
im.save(fp, 'JPEG')
fp.seek(0)
reloaded = Image.open(fp)
self.assert_image_similar(im, reloaded, 20)
def test_internals(self):
im = Image.new("L", (100, 100))

View File

@ -3,6 +3,13 @@ Pillow
Pillow is the friendly PIL fork by `Alex Clark and Contributors <https://github.com/python-pillow/Pillow/graphs/contributors>`_. PIL is the Python Imaging Library by Fredrik Lundh and Contributors.
.. image:: https://zenodo.org/badge/17549/python-pillow/Pillow.svg
:target: https://zenodo.org/badge/latestdoi/17549/python-pillow/Pillow
.. image:: https://readthedocs.org/projects/pillow/badge/?version=latest
:target: http://pillow.readthedocs.org/?badge=latest
:alt: Documentation Status
.. image:: https://travis-ci.org/python-pillow/Pillow.svg?branch=master
:target: https://travis-ci.org/python-pillow/Pillow
:alt: Travis CI build status (Linux)
@ -11,6 +18,10 @@ Pillow is the friendly PIL fork by `Alex Clark and Contributors <https://github.
:target: https://travis-ci.org/python-pillow/pillow-wheels
:alt: Travis CI build status (OS X)
.. image:: https://img.shields.io/appveyor/ci/python-pillow/Pillow/master.svg?label=Windows%20build
:target: https://ci.appveyor.com/project/python-pillow/Pillow
:alt: AppVeyor CI build status (Windows)
.. image:: https://img.shields.io/pypi/v/pillow.svg
:target: https://pypi.python.org/pypi/Pillow/
:alt: Latest PyPI version
@ -37,6 +48,12 @@ Pillow is the friendly PIL fork by `Alex Clark and Contributors <https://github.
about.rst
releasenotes/index.rst
.. raw:: html
<a href="https://gratipay.com/pillow/">
<img alt="Support via Gratipay" src="https://cdn.rawgit.com/gratipay/gratipay-badge/2.3.0/dist/gratipay.png"/>
</a>
Indices and tables
==================

View File

@ -54,12 +54,12 @@ Many of Pillow's features require external libraries:
* Pillow has been tested with libjpeg versions **6b**, **8**, and
**9** and libjpeg-turbo version **8**.
* Starting with Pillow 3.0.0, libjpeg is required by default, but
may be disabled with the `--disable-jpeg` flag.
may be disabled with the ``--disable-jpeg`` flag.
* **zlib** provides access to compressed PNGs
* Starting with Pillow 3.0.0, zlib is required by default, but may
be disabled with the `--disable-zlib` flag.
be disabled with the ``--disable-zlib`` flag.
* **libtiff** provides compressed TIFF functionality

View File

@ -42,4 +42,11 @@ have been removed in this release::
ImageWin.fromstring()
ImageWin.tostring()
LibJpeg and Zlib are Required by Default
----------------------------------------
The external dependencies on libjpeg and zlib are now required by default.
If the headers or libraries are not found, then installation will abort
with an error. This behaviour can be disabled with the ``--disable-libjpeg``
and ``--disable-zlib`` flags.