Closed paulocoutinhox closed 1 month ago
Could you post a copy of IMG_5615.jpeg here?
The DEBUG messages are coming from https://github.com/python-pillow/Pillow/blob/331e4e751733eb0af018602ef26746a7e0571107/src/PIL/TiffImagePlugin.py#L904-L941
I don't think of them as a problem - let us know if you're interested in not showing those.
Hi @radarhere, here is the image: https://www.dropbox.com/scl/fi/942uakezlq9amaxqy2g5f/ios-img-error-pillow.jpeg?rlkey=5xncrpabfco7c0xes08rj3cut&dl=1
Error:
DEBUG 2024-10-20 14:29:25,887 TiffImagePlugin tag: MPFVersion (45056) - type: undefined (7) - value: b'0100'
DEBUG 2024-10-20 14:29:25,887 TiffImagePlugin tag: NumberOfImages (45057) - type: long (4) - value: b'\x00\x00\x00\x02'
DEBUG 2024-10-20 14:29:25,887 TiffImagePlugin tag: MPEntry (45058) - type: undefined (7) Tag Location: 46 - Data Location: 50 - value: b'\x00\x03\x00\x00\x00#(\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xc6\xfc\x00#\x06\xc1\x00\x00\x00\x00'
Scenario: I take a photo direct from iPhone on upload field, nothing more.
Pillow has identified the image as an MPO.
So I think if you adjust your code to valid_mime_types = ["jpeg", "mpo", "png", "webp"]
, you will find that the ERROR goes away.
Ok, nice. I never will understand this. Thanks.
I have only one problem but i can open another issue if you want.
I want upload a webp file but always get this error:
File "/opt/homebrew/lib/python3.10/site-packages/django/db/models/fields/files.py", line 338, in pre_save
file.save(file.name, file.file, save=False)
File "/opt/homebrew/lib/python3.10/site-packages/django_resized/forms.py", line 136, in save
thumb.save(new_content, format=img_format, quality=self.field.quality, **img_info)
File "/opt/homebrew/lib/python3.10/site-packages/PIL/Image.py", line 2605, in save
save_handler(self, fp, filename)
File "/opt/homebrew/lib/python3.10/site-packages/PIL/WebPImagePlugin.py", line 300, in _save
data = _webp.WebPEncode(
ValueError: invalid configuration
I tried on linux and macos and already have libwebp installed and pillow return OK for webp module supported.
What can be wrong?
The following works for me.
from PIL import Image
im = Image.open('in.webp')
im.save('out.webp')
Does it work on your machine? If yes, then something in
thumb.save(new_content, format=img_format, quality=self.field.quality, **img_info)
is triggering the problem. If you can find out what the values of self.field.quality
and img_info
are, then we can debug this further.
Hi, no error happen and the image is saved without problem.
Ok, i will check it. Very thanks for your time.
What did you do?
Im trying make a simple upload from iPhone 14 and save the image.
It works from my iPhone 13 but not for iPhone 14.
I try select different compatible mode, different size etc.
What did you expect to happen?
Normal upload.
What actually happened?
Bad headers errors:
What are your OS, Python and Pillow versions?
If anyone wanna test, it is here: https://aixdg.com/
Thanks.