Skip to content

Commit 1c4fdea

Browse files
committed
more
1 parent c2a2daf commit 1c4fdea

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/diffusers/utils/remote_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
# TODO: `imghdr` is deprecated in Python 3.13 🙄
17+
import imghdr
1618
import io
1719
import json
1820
from typing import List, Literal, Optional, Union, cast
@@ -115,6 +117,8 @@ def postprocess(
115117
)
116118
elif output_type == "pil" and return_type == "pil" and processor is None:
117119
output = Image.open(io.BytesIO(response.content)).convert("RGB")
120+
detected_format = imghdr.what(None, h=response.content)
121+
output.format = detected_format
118122
elif output_type == "pil" and processor is not None:
119123
if return_type == "pil":
120124
output = [

0 commit comments

Comments
 (0)