Andrew Murray
a54d28a7bc
Merge branch 'main' into improved_dds
2023-10-21 14:27:31 +11:00
Andrew Murray
8b71f3d3c1
Added messages to errors
2023-10-19 18:42:41 +11:00
Andrew Murray
5e9a2e3000
Renamed "tile_args" to "args" for consistency with existing ImageFile variable
2023-10-17 19:10:24 +11:00
REDxEYE
a5dde8b1c4
Apply suggestion for PR
2023-10-12 19:09:28 +03:00
pre-commit-ci[bot]
777c54a4d1
[pre-commit.ci] auto fixes from pre-commit.com hooks
...
for more information, see https://pre-commit.ci
2023-06-15 00:09:03 +00:00
REDxEYE
9165771d5e
Add BC5U support. Seen in Amnesia: The Bunker
2023-06-15 03:08:04 +03:00
pre-commit-ci[bot]
3602e35818
[pre-commit.ci] auto fixes from pre-commit.com hooks
...
for more information, see https://pre-commit.ci
2023-06-15 02:37:36 +03:00
REDxEYE
de2b4be9b9
Add Tile namedtuple for code readability.
...
Add typing info to Image.tile
2023-06-15 02:30:31 +03:00
Andrew Murray
fcc59a4001
Use existing variable names from ImageFile
2023-02-25 16:31:26 +02:00
Aarni Koskela
04be46d484
Clarify variable names in ImageFile
...
Co-authored-by: Yay295 <Yay295@users.noreply.github.com>
2023-02-24 10:04:38 +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
68fdd2a9e7
Further improve exception traceback readability
2022-12-30 14:24:28 +11:00
Hugo van Kemenade
2ae55ccbda
Improve exception traceback readability
2022-12-30 00:07:52 +02:00
Andrew Murray
4f0b83cc54
Only set tile in ImageFile __setstate__
2022-12-09 12:29:27 +11:00
Andrew Murray
c463ef4fe3
Fallback to not using mmap if buffer is not large enough
2022-08-17 21:13:09 +10:00
Andrew Murray
8784ee1410
Moved code into separate function
2022-07-22 07:59:30 +10:00
Andrew Murray
886fcbe3d6
Do not open images with zero or negative height
2022-05-04 21:25:40 +10:00
Andrew Murray
bcded33cee
Merge pull request #6195 from hugovk/cleanup
...
Cleanup: various
2022-04-26 18:51:44 +10:00
Hugo van Kemenade
d241e38120
[Private] function names should be snake_case
2022-04-10 23:55:16 +03:00
Hugo van Kemenade
ee85e387ba
Remove redundant parentheses
2022-04-10 23:39:54 +03:00
Andrew Murray
e87432b745
First return value is unused
2022-03-08 19:51:24 +11:00
Andrew Murray
54a4a38e42
Return -1 when finished decoding
2022-03-08 19:48:58 +11:00
Andrew Murray
397a940995
Merge pull request #6094 from radarhere/decoder
...
Improved codec documentation
2022-03-07 08:01:31 +11:00
Hugo van Kemenade
c16737d589
Merge pull request #6096 from radarhere/cleanup
2022-03-06 20:12:13 +02:00
Andrew Murray
95e3194497
Improved documentation for _pulls_fd and _pushes_fd
2022-03-01 13:15:12 +11:00
Andrew Murray
bb9338e34d
Removed duplicate code
2022-02-28 14:13:04 +11:00
Andrew Murray
4d868abd8a
Moved non-codec code outside of try block
2022-02-28 14:13:04 +11:00
Andrew Murray
a606fd85a3
Run encoder cleanup method after errors as well
2022-02-28 14:12:56 +11:00
Andrew Murray
f2987d65c0
Linked to file codec documentation
2022-02-28 08:36:26 +11:00
Andrew Murray
a0e1fde1ed
Added PyEncoder
2022-02-25 16:07:01 +11:00
Andrew Murray
fb7edfda68
Improved consistency of returning an image access object from load()
2022-02-02 11:49:31 +11:00
Andrew Murray
7370a0b1cf
Remove consecutive duplicates that only differ by their offset
2022-01-01 14:54:23 +11:00
Andrew Murray
5c05fe4d9b
Fixed raising OSError in _safe_read when size is greater than SAFEBLOCK
2021-12-07 11:40:44 +11:00
Andrew Murray
ab6efcb925
Merge pull request #5665 from infmagic2047/master
...
Do not return in ImageFile when saving to stdout
2021-11-26 00:12:40 +11:00
Andrew Murray
83864b01cf
Removed Image.show command parameter
2021-10-18 11:08:51 +11:00
Andrew Murray
e444e7ab6d
Removed ImageFile.raise_ioerror
2021-10-18 11:06:02 +11:00
Yutao Yuan
f55ccd9563
Remove stdout check in ImageFile._save
2021-08-09 23:13:54 +08:00
Andrew Murray
f962b18f69
Catch OSError when checking if fp is sys.stdout
2021-07-06 11:00:03 +10:00
Andrew Murray
0f68e63793
Allow for sys.stdout.buffer to be missing
2021-05-03 18:07:05 +10:00
Andrew Murray
fae9afe351
Replace sys.stdout with sys.stdout.buffer when saving
2021-04-29 21:35:57 +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
f2f92d22d1
Do not use "use built-in mapper WIN32 only"
2021-01-30 11:23:24 +11:00
Hugo van Kemenade
0893f502c3
Document when deprecations will be removed [CI skip]
2020-12-10 14:32:43 +02:00
Hugo van Kemenade
e0eec1eb56
Merge branch 'master' into rm-3.5
2020-09-01 20:16:46 +03:00
Hugo van Kemenade
10615a7da7
Upgrade Python syntax for 3.6+
...
Co-authored-by: nulano <nulano@nulano.eu>
2020-07-30 10:09:18 +03:00
Andrew Murray
836dcc5ba0
Document missing attributes
2020-07-23 22:40:02 +10:00
Hugo van Kemenade
780294302d
Merge pull request #4734 from nulano/refs-missing
2020-06-28 09:29:31 +03:00
nulano
e4210eb8d7
fix ImageFile references
...
(cherry picked from commit 6ac071782f
)
2020-06-27 15:30:45 +02:00
Ram Rachum
2f0d430807
Fix exception causes all over the codebase
2020-06-21 13:21:25 +03:00
Andrew Murray
fe8225732a
Throw image loading error faster
2020-04-17 18:29:45 +10:00
Andrew Murray
7bb51a4aca
Raise DeprecationWarning on raise_ioerror
2020-04-10 12:57:29 +03:00
Hugo
dda6145fce
Since Python 3.3 IOError and WindowsError have been merged into OSError
2020-04-10 12:57:29 +03:00
Andrew Murray
6a7ac38c6c
extents are not used by map_buffer
2020-01-26 13:22:23 +11:00
Alexander
fd21de7dc4
Merge branch 'refs/heads/master' into box-in-thumbnail
...
# Conflicts:
# Tests/test_image_thumbnail.py
2019-11-24 05:27:13 +03:00
Alexander
2d1482b400
minor fixes related to draft
2019-11-24 04:33:34 +03:00
Hugo
cc63f66575
Merge remote-tracking branch 'upstream/master' into rm-2.7
2019-11-01 13:22:56 +02:00
Hugo van Kemenade
2cf510e596
Improve handling of file resources ( #3577 )
...
Improve handling of file resources
2019-11-01 12:07:53 +02:00
Hugo van Kemenade
40133cfc74
Merge branch 'master' into rm-2.7
2019-10-26 09:07:44 +03:00
Jon Dufresne
cae17eb927
Use more Pythonic super() instead of referencing parent class
...
https://rhettinger.wordpress.com/2011/05/26/super-considered-super/
2019-10-22 06:54:58 -07: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
Hugo
538d9e2e5d
Upgrade Python syntax with pyupgrade --py3-plus
2019-10-07 14:30:59 +03:00
Hugo van Kemenade
8e3c4e3658
Merge pull request #3965 from radarhere/truncated
...
Raise the same error if a truncated image is loaded a second time
2019-09-20 22:53:52 +03:00
Andrew Murray
023dcf27c2
Raise the same error if a truncated image is loaded a second time
2019-07-13 08:37:17 +10: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
Hugo
53a7e35004
Format with Black
2019-06-10 18:22:46 +03:00
Andrew Murray
40bc46ff49
Moved ImageFile.Exif to Image.Exif
2019-04-01 20:03:02 +11:00
Andrew Murray
259a2ce2b2
Removed camelcase
2019-03-31 08:09:01 +11:00
Andrew Murray
64910d1921
Parse Nintendo and Fujifilm MakerNote tags
2019-03-28 21:13:12 +11:00
Andrew Murray
e6a7dc8bb4
Capitalisation
2019-03-28 21:13:12 +11:00
Hugo
9cbc4b1e3c
Apply suggestions from code review
...
Co-Authored-By: radarhere <3112309+radarhere@users.noreply.github.com>
2019-03-28 21:13:12 +11:00
Andrew Murray
3caec4344e
Added get_ifd method to access embedded IFDs
2019-03-28 21:13:12 +11:00
Andrew Murray
d5db62be7b
Added EXIF class
2019-03-28 21:13:12 +11:00
Jon Dufresne
deb8a7aadd
Remove additional references to removed handles_eof
...
handles_eof was removed in 90760a5f30
.
2019-03-22 05:58:22 -07:00
Andrew Murray
58e60510e6
Merge pull request #3549 from radarhere/mimetype
...
Improved get_format_mimetype logic
2019-03-08 10:06:47 +11:00
Hugo
b75210d824
Merge pull request #3572 from jdufresne/seek-constants
...
Replace .seek() magic numbers with io.SEEK_* constants
2019-02-27 23:30:27 +02:00
Andrew Murray
fbaf87ae03
Replaced strings with docstrings
2019-02-03 15:58:24 +11:00
Jon Dufresne
a00fc33c04
Replace .seek() magic numbers with io.SEEK_* constants
...
A bit more readable.
https://docs.python.org/3/library/io.html#io.IOBase.seek
2019-01-12 18:22:07 -08:00
Andrew Murray
4c0e32ccf2
Improved get_format_mimetype logic
2019-01-06 07:00:00 +11:00
Andrew Murray
97ae0c42b1
Detect whether mimetype is image/png or image/apng
2019-01-02 14:13:10 +11:00
Andrew Murray
f8fbac68de
Removed unused imports
2018-09-27 20:31:01 +10:00
Andrew Murray
c2189235af
Line too long
2018-07-02 19:26:02 +10:00
Hugo
d97e16c903
Merge pull request #3190 from radarhere/mimetype
...
Added ImageFile get_format_mimetype method
2018-07-01 21:19:57 +03:00
Andrew Murray
c971bac651
Changed mmap file pointer to use context manager
2018-07-01 12:19:30 +10:00
Andrew Murray
dbf899fb78
Removed manual determination of mmap file length
2018-07-01 12:09:23 +10:00
Andrew Murray
6793b5bbd5
Added ImageFile get_format_mimetype method
2018-06-30 21:08:41 +10:00
wiredfool
d173e81798
Merge pull request #3023 from kkopachev/issue-3022
...
Certain corrupted jpegs can result in no data read
2018-03-21 07:55:17 +00:00
Konstantin Kopachev
1e9e64c8b0
Move jpeg-specific eof-processing to jpeg plugin
2018-03-06 22:52:08 -08:00
Andrew Murray
f22f1628eb
At least two spaces before inline comment
2018-03-04 21:36:33 +11:00
Konstantin Kopachev
add2746ac6
Certain corrupted jpegs can result in no data read
...
On truncated jpeg, decoder can suspend waiting for additional bytes in
buffer. For some input files, decoder suspends on jpeg_start_decompress
stage. If at this point file reader reaches EOF, py code never gets back
to jpeg decoder and we end up with no bytes to result image. This leaves
us with some amount of potentially useful bytes undecoded and thrown
away.
Libjpeg docs suggest that in such situation, more appropriate would be
to add EOI marker to the end of buffer, which will allows decoder
to finish. https://github.com/libjpeg-turbo/libjpeg-turbo/blob/0dd9a2c1fd6c/libjpeg.txt#L1803-L1809
Docs also mention that adding EOI markers is what non-suspending code
does anyway.
2018-02-28 22:15:58 -08:00
wiredfool
0bb3f4fee9
source layout reorg
2017-12-28 14:49:47 +00:00