Skip to content

Direct Disk Reads #6615

Answered by radarhere
keshavvinayak01 asked this question in Q&A
Sep 24, 2022 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

If you look at the source code for Image.open,

def open(fp, mode="r", formats=None):

the first parameter determines how the file is opened.

Pillow/src/PIL/Image.py

Lines 3060 to 3063 in 65c832d

:param fp: A filename (string), pathlib.Path object or a file object.
The file object must implement ``file.read``,
``file.seek``, and ``file.tell`` methods,
and be opened in binary mode.

If it is a filename, then Python is used to open the file, otherwise the file object passed in is used for subsequent read operations.

Pillow/src/PIL/Image.py

Lines 3099 to 3109 in 65c832d

if filename:

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@keshavvinayak01
Comment options

@radarhere
Comment options

@keshavvinayak01
Comment options

@keshavvinayak01
Comment options

@radarhere
Comment options

Answer selected by keshavvinayak01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants