Commit Graph

186 Commits

Author SHA1 Message Date
wiredfool
b8d6fd57fa Merge pull request #1860 from radarhere/register_extensions
Added register_extensions method
2017-09-22 15:59:04 +01:00
wiredfool
6198422383 Merge pull request #2748 from wiredfool/i16s
Fix TIFF support for I;16S, I;16BS, and I;32BS rawmodes
2017-09-22 15:57:56 +01:00
Eric Soroos
60cbe9fe44 I;16(B)S and I;32BS aren't modes, they're rawmodes 2017-09-20 09:26:14 +00:00
Eric Soroos
488691bda4 General fix for issue #2278, #2006, ValueError with out of spec metadata 2017-09-14 20:05:13 +01:00
Eric Soroos
1f4699ca5b Specific fix for issue #2278, save fails with PhotoshopInfo tag 2017-09-14 20:05:13 +01:00
Andrew Murray
567351f632 Added register_extensions method 2017-09-04 20:32:07 +10:00
Alexander
de3f59d0a7 assume 2017-08-21 17:14:33 +03:00
Alexander
6422592196 Support invalid TIFF headers 2017-08-21 17:09:35 +03:00
Alexander
8c64275156 Load 16-bit RGB and RGBA TIFF image 2017-08-21 16:28:29 +03:00
wiredfool
1f19c023e1 Merge pull request #2406 from blochl/multiframe_tiff
Allow to save tiff stacks from separate images
2017-06-13 22:30:35 +01:00
hugovk
c70eb8a128 flake8 2017-05-27 23:55:14 +03:00
hugovk
e002207c5b Remove function deprecated and warning since 3.0 (1 Oct 2015) 2017-05-27 21:55:42 +03:00
Andrew Murray
37b293f593 Flake8 fixes 2017-04-20 21:14:23 +10:00
wiredfool
86c1704646 add _close_exclusive_fp_after_load flag 2017-04-03 08:06:58 -07:00
wiredfool
b69b70198f Closing only single frame TIFF images 2017-03-14 23:17:22 +00:00
homm
58484db509 close files after loading for some file types 2017-03-12 20:05:20 +00:00
Andrew Murray
bef530cb09 Changed None comparison to is 2017-03-03 21:38:19 +11:00
wiredfool
0ee223aa7a Merge pull request #1390 from radarhere/deprecated_27
Removed use of spaces in TIFF kwargs, deprecated in 2.7
2017-02-22 10:13:45 +00:00
Leonid Bloch
28b818974e Allow to save tiff stacks from separate images
This is a quick solution that will allow to save tiff stacks from
separate images, e.g. from Numpy arrays.
Previously, tiff stacks could be saved only from multiframe images.
This behavior is similar to what is possible now with GIFs.

Note however, that for correct results, all the appended images should
have the same encoder{info,config} properties.

Example:

import numpy as np
from PIL import Image
a = np.ones((100,100,100), dtype=np.uint8)
imlist = []
for m in a:
    imlist.append(Image.fromarray(m))

imlist[0].save("test.tif", compression="tiff_deflate", save_all=True,
               append_images=imlist[1:])

(Should result in a 100-frame, 100x100 tiff stack.)

Signed-off-by: Leonid Bloch <leonid.bloch@esrf.fr>
2017-02-17 00:57:00 +02:00
Marcus Brinkmann
8a9bd2cdcd Default to inch-interpretation for missing ResolutionUnit in TiffImagePlugin. 2017-01-19 17:24:28 +01:00
Andrew Murray
58b5c9187d Replaced absolute PIL imports with relative imports (#2349) 2017-01-17 13:22:18 +00:00
wiredfool
55f7a736a4 Merge pull request #2234 from radarhere/print
Updated comments to use print as a function
2016-12-13 20:00:25 +00:00
Andrew Murray
41e492b026 Removed use of spaces in TIFF kwargs, deprecated in 2.7 2016-12-09 20:44:42 +11:00
wiredfool
86606022c5 Merge pull request #2193 from SemanticsOS/lambdafu/libtiff-icc
Update info.icc_profile when using libtiff reader.
2016-12-03 13:44:26 +00:00
wiredfool
e0b957240b Merge pull request #2087 from cskau/patch-1
Fixes TIFFImagePlugin ICC color profile saving.
2016-11-29 19:33:52 +00:00
Andrew Murray
4ed31e8ef7 Updated comments to use print as a function 2016-11-26 11:02:44 +11:00
Jon Dufresne
dbe9f85c7d Drop support for Python 2.6
* Drop unittest2 requirement
* Use set literals
* Use dict/set comprehension
* Use str.format() automatic numbering
2016-11-22 04:23:55 -08:00
Jon Dufresne
ffa5bc2726 Use generator expressions instead of list comprehension
Avoids unnecessary temporary lists in memory.
2016-11-14 18:11:15 -08:00
Andrew Murray
8fc90fe4fa Replaced range(len()) 2016-11-06 12:38:59 +11:00
Clement Skau
caf53b05ec Fixes TIFFImagePlugin ICC color profile saving.
In the TIFF code saving icc_profile is conditional on tag_v2 being set which doesn't make sense to me. I believe this is merely an indentation typo.

I've been trying to save TIFFs with im.info['icc_profile'] set and compression=raw, but unfortunately this results in TIFFs without ICC color profiles.
With the attached patch TIFFs with said conditions will be saved with the profile set in im.info['icc_profile'].

Note: There are a number of different conditions that need to be met for code to succeed in saving with the profile since it branches between using libtiff and ImageFile._save(..), and the libtiff code does not currently save the ICC color profile.
For instance setting compression=tiff_lzw will result in using libtiff and no profile will be saved.
2016-11-05 15:01:39 +09:00
Marcus Brinkmann
66de02685f Update info.icc_profile when using libtiff reader. 2016-11-04 16:37:49 +01:00
Jon Dufresne
e44bb42ae9 Replace type() equality checks with isinstance 2016-10-31 06:41:43 -07:00
wiredfool
d9fc1848a2 Merge pull request #2140 from SemanticsOS/lambdafu/tiff-multipage
Add TIFF save_all writer.
2016-10-03 06:31:39 -07:00
wiredfool
2db3f00e92 Merge pull request #2141 from wiredfool/tiff_fd
Move libtiff fd duplication to _load_libtiff
2016-10-03 06:03:50 -07:00
wiredfool
41cbd4f4d3 Only duplicate the file descriptor when acually passing it to
libtiff.  From: Sebastian Krause <sebastian@realpath.org>
2016-09-29 22:14:51 +01:00
wiredfool
4a90e8f75b Merge pull request #2024 from uploadcare/fix-empty-exif-tags
Skip empty values in ImageFileDirectory
2016-09-29 08:24:44 -07:00
Marcus Brinkmann
92c7337df0 Add TIFF save_all writer. 2016-09-29 17:05:33 +02:00
Antony Lee
7e9c944caf Fix saving originally missing TIFF tags.
Don't incorrectly set the tag type to None if it was originally missing.
2016-09-19 00:31:17 -07:00
homm
c2b4ff5fa4 skip empty values in ImageFileDirectory 2016-07-12 18:09:02 +03:00
wiredfool
c50503a14d API change/revert: Bytes should be returned as a single byte string, not a tuple of integers 2016-06-26 12:06:56 +01:00
Andrew Murray
b1a528bf10 Changed variable names to avoid redefining builtins 2016-05-10 22:31:36 +10:00
wiredfool
14f3b45f46 Merge pull request #1789 from zwhfly/tiff
Add Support for 2/4 bpp Tiff Grayscale Images
2016-04-03 12:07:48 -07:00
Andrew Murray
26bf1937c7 Added warning for deprecated as_dict method 2016-04-03 23:41:28 +10:00
Andrew Murray
677b958a7f Health fixes 2016-04-01 21:49:30 +11:00
zwhfly
aa0636d811 Add Tiff Encodings for 2/4 Bit Grayscale Images
Added decoding support for 2/4 bit grayscale tiff images, including inverted and/or bit-order-reversed formats.
2016-03-29 20:19:22 +08:00
zwhfly
46134f78d2 Rearrange Tiff Encodings List
Refined the order of items in the dict 'OPEN_INFO'.
2016-03-29 20:19:21 +08:00
Andrew Murray
886a7cf206 Different TIFF frames may have different compression 2016-03-27 22:18:39 +11:00
wiredfool
9fa6634f4d Partial fix for #1597
Haven't excercized all of the metadata that we're allowing yet,
and there's clearly still something up with Arrays, as one
of them is still crashing and making it impossible to save a
palette with a libtiff image.
2015-12-30 07:54:14 -08:00
wiredfool
80ab12bdc0 Lookup tag info in both _v2(info) and original(name only) dicts, delegate to lookup 2015-12-29 22:02:11 +00:00
wiredfool
3ac9396e8c Write round trip for rationals, including nan value 2015-12-29 22:00:36 +00:00