Commit Graph

69 Commits

Author SHA1 Message Date
Andrew Murray
888b2f716e Improved consistency of example paths 2024-07-24 06:56:42 +10:00
Andrew Murray
cf6ec5e065 Converted images to WebP 2024-07-24 06:44:06 +10:00
Jeffrey A. Clark (Alex)
96fa1f5dbf multiply each pixel by 20 2024-07-23 14:55:04 -04:00
Jeffrey A. Clark (Alex)
ddc02bb78c Update and add image to PostScript printing example 2024-07-20 14:41:47 -04:00
Jeffrey A. Clark
eff22bc34e
Update docs/handbook/tutorial.rst
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2024-07-19 09:00:26 -04:00
Andrew Murray
54055c76c4 Converted images to WebP 2024-07-19 18:45:00 +10:00
Andrew Murray
1daaef02cd Updated code to match image 2024-07-19 18:27:00 +10:00
Andrew Murray
c337dfe98a Correct reference 2024-07-19 14:41:51 +10:00
Jeffrey A. Clark (Alex)
96a1af9fa8 Add tutorial images
Animated gif example
2024-07-18 18:33:14 -04:00
Jeffrey A. Clark (Alex)
18d8020cab Add tutorial images 2024-07-18 15:17:32 -04:00
Andrew Murray
34b3cb519c Converted example images to WebP 2024-04-10 23:37:38 +10:00
Nulano
de62b25ed3 fix image url in "Reading from URL" example 2024-01-01 18:06:46 +01:00
Andrew Murray
d682c18ded Use "gray" more consistently 2023-10-19 19:12:01 +11:00
Andrew Murray
76049de4ad Fixed typos in tutorial 2023-10-15 22:39:35 +02:00
Andrew Murray
1c5eab718f Include given size in table 2023-09-29 18:29:45 +10:00
Andrew Murray
40d11fa9ac Added demonstration images to tutorial 2023-09-28 08:27:56 +10:00
Jan-Hendrik Müller
f9bf1cd59d
Update docs/handbook/tutorial.rst
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2022-04-16 08:12:54 +02:00
Jan-Hendrik Müller
12665d8db4
add read from URL example 2022-04-15 14:02:52 +02:00
Andrew Murray
b12c2fe682 Added merging images example 2022-03-12 16:17:56 +11:00
Andrew Murray
f8e4e9c2dd Added enums 2022-01-15 09:02:31 +11:00
mergify[bot]
591e79e01e
Merge pull request #5862 from kolibril13/pathlib
Added PIL + pathlib Tutorial
2021-12-19 23:11:07 +00:00
Andrew Murray
a12c18608e
Corrected variable name 2021-12-20 09:39:09 +11:00
Jan-Hendrik Müller
36caa53fed
Apply suggestions from code review
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2021-12-19 22:48:23 +01:00
Jan-Hendrik Müller
cd613e6850
Apply suggestions from code review
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2021-12-19 13:26:30 +01:00
Andrew Murray
6c8ac0e700 Added "os" example 2021-12-18 21:59:09 +11:00
Andrew Murray
946571d4a3 Moved batch processing example under "More on reading images" 2021-12-18 21:23:07 +11:00
Andrew Murray
d455abffee Moved all pathlib logic out of function 2021-12-18 21:16:50 +11:00
Andrew Murray
675c5e1a9c Apply black formatting to code examples 2021-12-04 07:50:08 +11:00
Jan-Hendrik Müller
cab7d8a8ab
Apply suggestions from code review
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2021-12-02 16:20:13 +01:00
Jan-Hendrik Müller
21351c8982
Update docs/handbook/tutorial.rst
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2021-12-01 23:23:17 +01:00
Jan-Hendrik Müller
52ac725ae0
Apply suggestions from code review
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2021-12-01 23:06:52 +01:00
Jan-Hendrik Müller
af924a1f96 added pathlib tutorial 2021-12-01 17:21:21 +01:00
Andrew Murray
0f68e63793 Allow for sys.stdout.buffer to be missing 2021-05-03 18:07:05 +10:00
Andrew Murray
9c06ce044c Changed PSDraw default from sys.stdout to sys.stdout.buffer 2021-04-29 21:35:57 +10: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
nulano
0083ebb3d4 fix various reference typos 2020-07-11 13:25:10 +10:00
Hugo van Kemenade
384523fab2 Fix PostScript typos 2020-07-10 11:48:02 +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
04f7c75466 Use context manager when opening images [ci skip] 2020-02-29 10:29:44 +11:00
Andrew Murray
db970acfa5 Grammar fix [ci skip] 2020-02-06 20:10:34 +11:00
Andrew Murray
1f58028173 Use BytesIO instead of StringIO [ci skip] 2020-01-21 23:21:57 +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
Hugo
0caa48b179 Remove redundant __future__ from docs
Co-Authored-By: Jon Dufresne <jon.dufresne@gmail.com>
2019-10-08 17:26:11 +03:00
Hugo
f792ab6c02 RST uses double backticks for code (MD uses 1) 2019-09-13 08:56:33 +03:00
Andrew Murray
38df9bef09 Added import [ci skip] 2019-05-06 08:38:43 +10:00
Andrew Murray
fa8ecffff2 Corrected seek documentation 2019-03-17 00:00:10 +11:00
Andrew Murray
bd600c6966 Crop is no longer lazy [ci skip] 2018-09-29 15:31:10 +10:00
Andrew Murray
6072e2e595 Changed note to be more generic [ci skip] 2018-09-29 15:12:48 +10:00
Andrew Murray
454ffe4a01 Changed tutorial code to use docstring [ci skip] 2018-01-12 20:46:16 +11:00