From cc84ff5e7d721a1309ba8e6ebd80238f90af389d Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 17 Apr 2023 16:10:29 +1000 Subject: [PATCH] Note that open() seeks to the start of file objects --- src/PIL/Image.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 5a43f6c4a..6dfde70a0 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -3156,7 +3156,8 @@ def open(fp, mode="r", formats=None): :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. + and be opened in binary mode. The file object will also seek to zero + before reading. :param mode: The mode. If given, this argument must be "r". :param formats: A list or tuple of formats to attempt to load the file in. This can be used to restrict the set of formats checked.