Andrew Murray
3465a598e2
Pass back index of image in sequence, instead of filename
2023-10-02 18:33:48 +11:00
Andrew Murray
6850465d54
Added progress callback when save_all is used
2023-10-02 15:44:43 +11:00
Hugo van Kemenade
ae921956ba
Merge pull request #7078 from radarhere/long8
2023-06-13 19:48:55 +03:00
Andrew Murray
a4986ba986
Support reading signed 8-bit TIFF images
2023-05-04 07:54:30 +10:00
Andrew Murray
dd15f15d08
Added further field sizes
2023-04-10 09:06:20 +10:00
Andrew Murray
90c226c69a
Merge branch 'main' into tiff
2023-03-12 22:30:15 +11:00
Andrew Murray
9ed8ca1494
Removed "del im"
2023-03-03 10:28:36 +02:00
Aarni Koskela
43128ce716
Fix up pytest.warns lambda: uses
2023-02-23 16:06:40 +02:00
pre-commit-ci[bot]
24183d652e
[pre-commit.ci] auto fixes from pre-commit.com hooks
...
for more information, see https://pre-commit.ci
2023-02-06 19:27:19 +00:00
Andrew Murray
412f5a5233
Moved test_wrong_bits_per_sample to test_file_libtiff.py
2023-01-29 17:33:51 +11:00
Andrew Murray
510de501ea
Moved test_get_child_images to test_file_libtiff.py
2023-01-29 17:33:46 +11:00
Hugo van Kemenade
799a6a0105
Fix linting
2022-10-29 12:06:30 +03:00
Hugo van Kemenade
00b25fd3ac
Hide UserWarning in logs
...
Tests/test_file_tiff.py::TestFileTiff::test_oom[Tests/images/oom-225817ca0f8c663be7ab4b9e717b02c661e66834.tif]
PIL/TiffImagePlugin.py:850: UserWarning: Corrupt EXIF data. Expecting to read 12 bytes but only got 6.
warnings.warn(str(msg))
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2022-10-29 12:06:27 +03:00
Eric Soroos
05b175ef88
Tighter test case
2022-10-29 12:06:24 +03:00
Eric Soroos
13f2c5ae14
Prevent DOS with large SAMPLESPERPIXEL in Tiff IFD
...
A large value in the SAMPLESPERPIXEL tag could lead to a memory and
runtime DOS in TiffImagePlugin.py when setting up the context for
image decoding.
2022-10-29 12:06:18 +03:00
Mark Mayo
69baeccf2e
some pylint warnings
...
Fixed some pylint issues
2022-10-13 15:20:11 +13:00
Andrew Murray
c259ac492f
Parametrized tests
2022-10-03 16:57:42 +11:00
Andrew Murray
ed016f8f5a
Parametrized test
2022-09-11 09:20:45 +10:00
Andrew Murray
beb7b4d0f6
Added reading of TIFF child images
2022-09-10 22:50:54 +10:00
Andrew Murray
b1885779a9
Once exif data is parsed, do not reload unless it changes
2022-05-27 07:54:54 +10:00
Hugo van Kemenade
33f00c9ca8
Merge pull request #6231 from radarhere/bmp_compression
...
Ignore compression value from BMP info dictionary when saving as TIFF
2022-05-20 16:18:15 +03:00
Hugo van Kemenade
2c58c3ee11
Merge pull request #6213 from radarhere/fp
2022-05-19 18:52:55 +03:00
Andrew Murray
4e52d06e6c
Added test
2022-05-05 17:57:08 +10:00
Andrew Murray
2c5e5049db
Ignore compression value from BMP info dictionary
2022-04-21 07:58:12 +10:00
Andrew Murray
e62449f94c
Added DeferredError to _fp
2022-04-17 12:14:53 +10:00
Hugo van Kemenade
9951de08c0
[Test] argument name should be snake_case
2022-04-11 15:29:01 +03:00
Hugo van Kemenade
a715bf2d6f
[Test] function name should be snake_case
2022-04-11 15:29:01 +03:00
Hugo van Kemenade
1bc0e1bb9d
Merge pull request #5973 from radarhere/planar_configuration
2022-03-27 18:52:44 +03:00
Andrew Murray
ebdb47e693
Support reading I;16R TIFF images
2022-03-20 13:34:50 +11:00
Andrew Murray
fc7319318e
Added BigTIFF reading
2022-03-01 09:23:12 +11:00
Andrew Murray
dae1f691c2
Updated checks that no warnings were raised
2022-02-21 13:49:01 +11:00
mergify[bot]
89768e3d57
Merge pull request #6042 from radarhere/tiff_bits
...
Clarify code and comments
2022-02-10 21:20:22 +00:00
Hugo van Kemenade
f5fab326fa
Merge pull request #6030 from radarhere/photoshopblocks
...
Added get_photoshop_blocks() to parse Photoshop TIFF tag
2022-02-10 09:40:17 +02:00
Andrew Murray
2ae70f144f
Added get_photoshop_blocks() to parse Photoshop tag
2022-02-10 12:00:23 +11:00
Andrew Murray
e098481279
Combined width and height into size
2022-02-10 11:02:13 +11:00
Mikhail Iurkov
2bbf5f0981
Lint
2022-02-09 16:53:27 +03:00
Mikhail Iurkov
bb5a090f60
Drop excess values in BITSPERSAMPLE
2022-02-09 16:40:43 +03:00
Andrew Murray
67944cedc7
Always save with contiguous planar configuration
2022-01-18 19:40:57 +11:00
Andrew Murray
7370a0b1cf
Remove consecutive duplicates that only differ by their offset
2022-01-01 14:54:23 +11:00
Andrew Murray
3f3828040b
Merge branch 'master' into tiff_exif
2021-09-07 06:33:37 +10:00
Hugo van Kemenade
d773fcd23d
Filter out UserWarning: Truncated File Read
2021-08-24 11:33:43 +03:00
Andrew Murray
9bf7dae03d
Allow saving L mode TIFF with PhotometricInterpretation 0
2021-08-06 23:50:52 +10:00
Andrew Murray
2dab52b8a8
Allow saving 1 mode TIFF with PhotometricInterpretation 0
2021-08-05 23:27:08 +10:00
Andrew Murray
9707d33ed9
Allow "exif" to also accept bytestring
2021-07-04 13:32:41 +10:00
Andrew Murray
c0f619384c
Added "exif" keyword argument to save Image.Exif instance
2021-07-04 12:33:55 +10:00
Andrew Murray
0aa8bd00e7
Added warning if defusedxml is not found
2021-06-30 11:29:13 +10:00
Andrew Murray
d9d811ff21
Replaced xml.etree.ElementTree with defusedxml.ElementTree
2021-06-30 11:28:44 +10:00
Hugo van Kemenade
b5c4b9afe0
Merge pull request #5455 from radarhere/xmp
2021-06-28 18:43:04 +03:00
Hugo van Kemenade
9f28e4be26
Merge pull request #5412 from radarhere/ifdrational_eq_float
2021-06-28 18:33:46 +03:00
Hugo van Kemenade
6d94376d1f
Merge pull request #5416 from radarhere/tiff_exif
...
Allow getexif() to access TIFF tag_v2 data
2021-06-28 18:12:17 +03:00
Andrew Murray
ae3bdf87f0
Added getxmp() for TIFF
2021-06-12 12:17:38 +10:00
Hugo van Kemenade
1ac7bd9f87
Merge pull request #5473 from radarhere/tiff_seek
...
Do not allow TIFF to seek to a past frame
2021-06-05 18:49:34 +03:00
Andrew Murray
7bfaffd5fa
Simplified tests now that casting to float is not needed
2021-05-10 09:36:57 +10:00
Andrew Murray
9ac888262a
Do not allow TIFF to seek to a past frame
2021-05-08 00:25:47 +10:00
Andrew Murray
b78cf8cd75
Added state methods to allow pickling of IFDRational
2021-04-29 22:47:44 +10:00
Andrew Murray
537cd7a82e
Removed TIFF DPI rounding
2021-04-29 22:47:44 +10:00
Andrew Murray
622ba122ce
Added Exif load_from_fp method to get TIFF tag_v2 data
2021-04-29 21:21:55 +10:00
Hugo van Kemenade
8febdad8dd
Review, typos and lint
2021-04-01 17:41:46 +03:00
Eric Soroos
22e9bee4ef
Fix DOS in PSDImagePlugin -- CVE-2021-28675
...
* PSDImagePlugin did not sanity check the number of input layers and
vs the size of the data block, this could lead to a DOS on
Image.open prior to Image.load.
* This issue dates to the PIL fork
2021-04-01 17:17:31 +03:00
Andrew Murray
f42d6cf1ac
Save ICC profile from TIFF encoderinfo
2021-03-10 20:16:49 +11:00
Andrew Murray
a5c251029c
Replaced various instances of assert_image_equal with assert_image_equal_tofile
2021-02-21 22:15:56 +11:00
Hugo van Kemenade
1857bf5570
Merge pull request #5259 from radarhere/warns
2021-02-17 21:31:15 +02:00
Andrew Murray
83542c42bf
Added context managers
2021-02-11 21:43:54 +11:00
Andrew Murray
4a0569e97f
Changed zero length assertions to falsy
2021-02-11 13:48:31 +11:00
Andrew Murray
01be700081
Fixed asserting that no warnings were raised
2021-02-10 23:37:55 +11:00
Andrew Murray
eb7e5d2797
Moved test that requires libtiff
2021-01-29 08:00:37 +11:00
Andrew Murray
8794610c76
Block TIFFTAG_SUBIFD
2020-12-22 11:38:02 +11:00
Andrew Murray
f886bc973b
Moved string_dimension image to pillow-depends
2020-10-19 21:32:56 +11:00
Andrew Murray
1a3367400c
Added reading of IFD tag type
2020-10-14 23:37:54 +11:00
Andrew Murray
298b7d0333
Update pre-commit
2020-08-31 18:50:15 +10:00
Hugo van Kemenade
dd87dd50c0
Update to isort 5 with Black profile support
2020-08-08 22:39:29 +03:00
Andrew Murray
fda22ed82e
Removed unused variables
2020-07-29 07:54:33 +10:00
Hugo
dda6145fce
Since Python 3.3 IOError and WindowsError have been merged into OSError
2020-04-10 12:57:29 +03:00
Hugo
fbd4ca1ba0
Fix roundtrip
2020-03-04 13:21:23 +02:00
Hugo
2cc6a9a974
Convert to use pytest
2020-03-02 16:31:08 +02:00
Andrew Murray
8482919a37
Converted most assert statements to pytest
2020-02-23 00:06:21 +11:00
Hugo
38bf862185
Replace PillowTestCase.assert_warning with pytest.warns
2020-02-03 11:11:32 +02:00
Hugo
a4bf9fa036
Convert most PillowTestCase methods to pytest
2020-02-02 12:26:01 +02:00
Andrew Murray
c0048ad7de
Use context managers
2019-11-26 07:03:23 +11:00
Jon Dufresne
33dabf986f
Import unittest from stdlib rather than helper.py
...
The unittest in helper.py has not offered an interesting abstraction
since dbe9f85c7d
so import from the more
typical stdlib location.
2019-11-20 18:42:52 -08:00
Hugo van Kemenade
5006401d0b
Merge branch 'master' into rm-2.7
2019-11-03 22:48:26 +02:00
Andrew Murray
b1ee44a74b
Ignore UserWarnings
2019-11-02 18:10:55 +11:00
Hugo
cc63f66575
Merge remote-tracking branch 'upstream/master' into rm-2.7
2019-11-01 13:22:56 +02:00
Jon Dufresne
4cd4adddc3
Improve handling of file resources
...
Follow Python's file object semantics. User code is responsible for
closing resources (usually through a context manager) in a deterministic
way.
To achieve this, remove __del__ functions. These functions used to
closed open file handlers in an attempt to silence Python
ResourceWarnings. However, using __del__ has the following drawbacks:
- __del__ isn't called until the object's reference count reaches 0.
Therefore, resource handlers remain open or in use longer than
necessary.
- The __del__ method isn't guaranteed to execute on system exit. See the
Python documentation:
https://docs.python.org/3/reference/datamodel.html#object.__del__
> It is not guaranteed that __del__() methods are called for objects
> that still exist when the interpreter exits.
- Exceptions that occur inside __del__ are ignored instead of raised.
This has the potential of hiding bugs. This is also in the Python
documentation:
> Warning: Due to the precarious circumstances under which __del__()
> methods are invoked, exceptions that occur during their execution
> are ignored, and a warning is printed to sys.stderr instead.
Instead, always close resource handlers when they are no longer in use.
This will close the file handler at a specified point in the user's code
and not wait until the interpreter chooses to. It is always guaranteed
to run. And, if an exception occurs while closing the file handler, the
bug will not be ignored.
Now, when code receives a ResourceWarning, it will highlight an area
that is mishandling resources. It should not simply be silenced, but
fixed by closing resources with a context manager.
All warnings that were emitted during tests have been cleaned up. To
enable warnings, I passed the `-Wa` CLI option to Python. This exposed
some mishandling of resources in ImageFile.__init__() and
SpiderImagePlugin.loadImageSeries(), they too were fixed.
2019-10-12 08:27:17 -07:00
Andrew Murray
4140cd807b
Merge branch 'master' into rm-2.7
2019-10-12 18:03:58 +11:00
nulano
a0a5601689
Merge branch 'master' into gha-win
2019-10-08 12:56:43 +01:00
Andrew Murray
6cd99fc3cf
Merge branch 'master' into rm-2.7
2019-10-08 18:57:27 +11:00
Jon Dufresne
64032061c0
Move several imports to the top-level of the file
...
This better follows PEP 8 style guide:
https://www.python.org/dev/peps/pep-0008/#imports
> Imports are always put at the top of the file, just after any module
> comments and docstrings, and before module globals and constants.
This also avoids duplicate import code within the same file.
2019-10-07 06:28:36 -07:00
Hugo
538d9e2e5d
Upgrade Python syntax with pyupgrade --py3-plus
2019-10-07 14:30:59 +03:00
Hugo
af770a6c55
Drop support for EOL Python 2.7
2019-10-07 14:30:59 +03:00
Andrew Murray
d6ae0a99a7
Removed deprecated setting of TIFF image sizes
2019-10-03 22:12:28 +10:00
Andrew Murray
9a977b975c
Raise error if dimension is a string
2019-09-30 18:48:10 +10:00
Andrew Murray
4de10089f0
Moved libtiff test into libtiff test file
2019-09-29 21:06:11 +10:00
nulano
cf1f8b0498
Tests.helper cleanup
2019-09-25 11:58:02 +02:00
Jon Dufresne
d50445ff30
Introduce isort to automate import ordering and formatting
...
Similar to the recent adoption of Black. isort is a Python utility to
sort imports alphabetically and automatically separate into sections. By
using isort, contributors can quickly and automatically conform to the
projects style without thinking. Just let the tool do it.
Uses the configuration recommended by the Black to avoid conflicts of
style.
Rewrite TestImageQt.test_deprecated to no rely on import order.
2019-07-06 16:11:35 -07:00
Andrew Murray
42588a6493
Skip test if libtiff is not installed
2019-06-30 13:26:58 +10:00
Andrew Murray
cc0d70145b
Lint fixes
2019-06-30 13:26:58 +10:00
Christoph Gohlke
4a69223db9
Add test for sampleformat corruption
2019-06-30 13:26:58 +10:00
Hugo
f87821e010
Format with Black
2019-06-13 18:54:11 +03:00
Andrew Murray
e131fa22e2
Fixed reading and saving for TIFF and IM in PA mode
2019-05-11 14:43:48 +10:00