mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 09:14:27 +03:00
Merge pull request #6215 from kolibril13/readURL
Add example to read image from URL
This commit is contained in:
commit
46ba6b51de
|
@ -504,6 +504,17 @@ image header. In addition, seek will also be used when the image data is read
|
|||
tar file, you can use the :py:class:`~PIL.ContainerIO` or
|
||||
:py:class:`~PIL.TarIO` modules to access it.
|
||||
|
||||
Reading from URL
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
::
|
||||
|
||||
from PIL import Image
|
||||
from urllib.request import urlopen
|
||||
url = "https://python-pillow.org/images/pillow-logo.png"
|
||||
img = Image.open(urlopen(url))
|
||||
|
||||
|
||||
Reading from a tar archive
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user