Commit Graph

193 Commits

Author SHA1 Message Date
Andrew Murray
c2189235af Line too long 2018-07-02 19:26:02 +10:00
Andrew Murray
9a3d554c1d Changed Exception tests to be more specific 2018-06-12 04:41:31 +10:00
Andrew Murray
5ef5a3c9b2 Corrected test 2018-06-06 22:34:09 +10:00
Andrew Murray
b4e6cdadac Added py3 variable to _util 2018-04-20 09:19:13 +10:00
Andrew Murray
c13ccf13a1 Added missing whitespace 2018-03-06 19:53:07 +11:00
Andrew Murray
2202196162 Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
Andrew Murray
30b2ddd070 Removed duplicate imports 2018-01-04 15:40:46 +11:00
Eric Soroos
e617d05b9e These tests/features now require libtiff 2017-12-20 12:22:28 +00:00
Eric Soroos
4877552581 Read all compressed files through libtiff. 2017-12-20 11:55:40 +00:00
Eric Soroos
bec8f415be end to end test helper, more end to end tests for tiffs 2017-12-20 11:55:40 +00:00
Tomasz Jezierski
bc6683cecf tiff-colors-fix test adjust 2017-12-20 11:54:26 +00:00
wiredfool
9ed4ea9e47
Merge pull request #2883 from uploadcare/tiff-wrong-bitspersample
Fix count of BITSPERSAMPLE items in broken TIFF files
2017-12-09 14:32:47 +00:00
Alexander
ce151bcd72 add test for this case 2017-12-08 17:32:39 +03:00
Andrew Murray
bc255c97ff Added support for generators when using append_images 2017-11-04 10:46:15 +11:00
Andrew Murray
f61b70aa8f Changed EOFError tests 2017-09-30 13:33:06 +10:00
Andrew Murray
78c62727d3 Moved seek frame position check into ImageFile 2017-09-30 13:32:43 +10:00
wiredfool
fd8ee8437b Merge pull request #2315 from radarhere/is_animated
If n_frames is known, then use when determining is_animated
2017-09-29 15:26:22 +01:00
Eric Soroos
a89c4e455d Target mode is I, check pixels 2017-09-20 09:26:40 +00:00
Andrew Murray
4087479464 Added test image 2017-09-20 09:04:48 +00:00
Andrew Murray
9e843a2d9b Changed format of lambda calls 2017-09-01 21:05:40 +10:00
Andrew Murray
371933a597 Added tests 2017-09-01 20:36:51 +10:00
Andrew Murray
c10ad19a2b Changed file opening in tests to use with 2017-09-01 20:03:54 +10:00
Alexander
846f986bc8 Tests for 16bit tiff 2017-08-21 17:10:05 +03:00
Andrew Murray
ce999ff302 If n_frames is known, then use when determining is_animated 2017-08-18 20:20:27 +10: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
wiredfool
c3e041e9e6 Merge branch 'master' into rm-deprecated-fn 2017-06-13 13:32:38 +01:00
Andrew Murray
e8cba27bb1 Changed assert checks to more specific versions 2017-06-03 14:04:54 +10: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
wiredfool
f95c158933 added non-exclusive fd for test 2017-04-04 00:27:20 -07:00
wiredfool
06b61f4e5b close the mmap when closing the image #2194 2017-04-03 08:06:59 -07:00
wiredfool
86c1704646 add _close_exclusive_fp_after_load flag 2017-04-03 08:06:58 -07:00
wiredfool
900c5e5bf2 added unix test for fd leak 2017-03-14 23:17:22 +00:00
wiredfool
e4e0e0d2bf Adjusted test to match expected behavior 2017-03-14 23:17:22 +00:00
Marcus Brinkmann
e8122600f6 Test for: Close file handle in TiffImagePlugin when image is closed. 2017-03-14 23:17:22 +00:00
Hugo
cb34b686a5 Merge pull request #1822 from radarhere/unused
Remove unused imports
2017-02-26 10:05:19 +02: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
97a2d42dac Removed unused print_function imports 2017-01-18 20:06:21 +11:00
Andrew Murray
41e492b026 Removed use of spaces in TIFF kwargs, deprecated in 2.7 2016-12-09 20:44:42 +11:00
wiredfool
aa247dbb60 Moving tests requiring libtiff to test_file_libtiff 2016-12-05 08:25:10 -08: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
Jon Dufresne
7992d2a65a Fix BytesWarning discovered while running tests
Discovered using the command:

python -b -m nose -vx Tests/test_*.py
2016-10-22 12:35:44 -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
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
Andrew Murray
b58f76dc4f Renamed references to OS X to macOS 2016-09-23 21:12:03 +10: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
Andrew Murray
572a3d970c Removed whitespace from blank lines 2016-09-03 12:23:42 +10:00
Eric Soroos
5b0a1a1c0d Moved tiff save / load of uint16 to test_file_tiff.
Saving a numpy generated image as a tiff will save in native endian, and comparing it to a
little endian tiff will fail on bigendian machines.
2016-08-25 12:49:40 -07:00
homm
107307dfc9 do not use as_dict anywhere in tests except tests for as_dict warnings 2016-07-12 21:34:15 +03:00
homm
1ba4e9e5ba remove end of file banner from all files 2016-07-10 14:11:28 +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
wiredfool
0bc06f7944 Fix filename on py2.6 2016-06-25 14:50:40 +01:00
Bryant Mairs
7fb24e8af0 Add test for reading and writing uint16 TIFFs. 2016-06-25 12:20:37 +01:00
Andrew Murray
63ae7fbfe9 Removed unnecessary lambdas 2016-05-10 22:20:49 +10:00
hugovk
839c52b96a flake8 2016-04-21 23:13:10 +03:00
hugovk
311f8f6a9c Test TIF with LZW compression 2016-04-21 23:10:08 +03:00
hugovk
ba817af569 Merge 2016-04-03 23:08:49 +03: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
124bee0485 Add Tests for 2/4 bpp Tiff Grayscale Images
Including inverted and/or bit-order-reversed formats.
2016-03-29 20:19:22 +08:00
Geka
33fff9e4a8 Add test for multipage tiff file with different compression 2016-03-27 22:19:04 +11:00
Andrew Murray
0ad6f5ff1f Updated deprecated asserts 2016-01-24 12:44:31 +11:00
Andrew Murray
957187d417 Added TIFF IFD test 2016-01-21 16:00:53 +11:00
Hugo
c0b3fe77d7 Merge pull request #1621 from radarhere/health
Flake8 fixes
2015-12-31 15:18:31 +02:00
Andrew Murray
a83bcec169 Flake8 fixes 2015-12-31 07:27:27 +11:00
wiredfool
deecbcd3a3 Added a rational class for TiffIFD that allows for 0/0 2015-12-27 10:21:31 +00:00
Andrew Murray
afa4166a57 Updated deprecated asserts 2015-12-16 14:30:17 +11:00
Andrew Murray
c27110ab56 Flake8 fixes 2015-12-10 21:34:02 +11:00
wiredfool
bceb18baa2 Merge pull request #1555 from Nexuapex/master
ExtraSamples tag should be a SHORT, not a BYTE
2015-12-07 12:53:51 +00:00
Andrew Murray
407aa77db4 Removed unnecessary lambda 2015-12-02 16:49:30 +11:00
John Calsbeek
b496f37e1f Add test for #1524. 2015-12-01 09:14:32 -08:00
Andrew Murray
9a2903bf5b Changed 32 bit to 32-bit and 64 bit to 64-bit 2015-10-15 00:49:03 +11:00
Andrew Murray
6bd7e7f02d Removed trailing whitespace 2015-10-11 21:24:35 +11:00
wiredfool
7206be535e Flatten sampleformat to initial value, fixes #1466 2015-10-03 22:57:44 +01:00
homm
0f87b1f125 suppress and check warning during tests 2015-09-15 04:07:02 +03:00
wiredfool
9286c9e460 Reenabling and fixing the former test_xyres_tiff test for integer resolutions 2015-09-14 05:10:27 -07:00
wiredfool
4adbc9735c Reorder load_* parameters to pass master tests 2015-09-14 04:35:09 -07:00
wiredfool
05348d4f8f Reenabling failing/crashing tests, with fixes 2015-09-14 03:03:24 -07:00
wiredfool
2636679868 updating tests for legacy_api api change 2015-09-13 14:08:49 +01:00
wiredfool
5f9fff0215 Restoring bad exif handling 2015-09-11 22:39:37 +01:00
wiredfool
47a963c2a4 Legacy/versioned interface 2015-09-11 22:39:37 +01:00
Antony Lee
ba7b8d1708 Fail on invalid EXIF, reverting ed2cca1. 2015-09-11 22:39:37 +01:00
Antony Lee
93abbd0caa Restore legacy TIFF API.
To have the old API that always returns tuples, and fractions as pairs,
set the `legacy_api` attribute of the IFD to True.

This should alleviate concerns about backwards compatibility.
2015-09-11 22:39:37 +01:00
Antony Lee
974bcc074b Major rewrite of TIFF ImageFileDirectory.
Do not represent scalar tags as 1-element tuples.  Keep tag
type and count information in TiffTags.TAGS.  Normalize data in
ImageFileDirectory.__setitem__: wrap and unwrap tuples as needed,
convert rationals to floats.  (To ensure consistency, make the "tags"
attribute private.)  Interpret byte data as a series of integers rather
than a bytearray (which should only map to the "undefined" type).  On
Python3, if a str is assigned to an "undefined" tag, encode it as ASCII.

Note that a large number of tags have been removed from TiffTags.TAGS
because I do not have time to figure out the type and count of each of
them.  They should be restored before this gets merged in.

This obviously breaks backwards compatibility in a lot of ways...
2015-09-11 22:34:50 +01:00
Andrew Murray
c6b13d294f Flake8 fixes 2015-08-25 22:27:18 +10:00
Andrew Murray
c7339c244e Added additional tests for TiffImagePlugin 2015-07-13 23:37:44 +10:00
Andrew Murray
309ab1fc3d Various Flake8 fixes 2015-07-03 16:22:56 +10:00
Alex Clark
67d1541c6f Merge pull request #1207 from anntzer/logger
Use logging instead of print.
2015-07-02 05:22:07 -04:00
Andrew Murray
d20eef450b Added is_animated 2015-06-30 13:25:00 +10:00
Antony Lee
4e754e9c55 Use logging instead of print.
cf. #1191.

Only TiffImagePlugin and OLEFileIO still rely on (their own) DEBUG flag.
I left TiffImagePlugin as it is because I hope #1059 gets merged in
first, and OLEFileIO because it uses its own logic.

Untested, as usual.
2015-06-29 12:39:50 -07:00
Andrew Murray
1111e9fb35 Fixed frame position when seeking past the end of file 2015-06-19 00:49:18 +10:00
hugovk
5c40cb1ba6 Merge 2015-06-08 20:46:39 +03:00
Andrew Murray
46f439604c Added tests 2015-06-08 01:02:43 +10:00
Andrew Murray
109ec638d9 Added test for bad EXIF data 2015-06-07 00:10:15 +10:00
Andrew Murray
4e2de9d9ed Added missing future print imports and removed unnecessary imports 2015-05-23 20:28:41 +10:00
Andrew Murray
d1c182cadc Various Flake8 fixes 2015-04-24 09:26:52 +10:00