Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix jpeg handling #6305

Merged
merged 2 commits into from Jan 4, 2023
Merged

fix jpeg handling #6305

merged 2 commits into from Jan 4, 2023

Conversation

vladmandic
Copy link
Collaborator

fix infamous KeyError: '.jpg' (not fully fixed in #5838 and tons of bug reports to quote)

this is a non-intrusive pr and does not touch exif handling which will be addressed in separate pr

@aliencaocao
Copy link
Contributor

With gradio 3.15.0 this should be fully fixed already, no need for any workaround in this repo

@vladmandic
Copy link
Collaborator Author

its fixed in underlying pillow and gradio 3.15 uses that correctly, but gradio that does not enforce pillow version.
(there were plenty of other apps impacted (not just gradio))

this pr also removes unnecessary imports and performs pillow init which is recommended to do once since we cant be sure which import messed up what (that was the original root cause)

from pillow docs for Image.init():

    Explicitly initializes the Python Imaging Library. This function
    loads all available file format drivers.

@aliencaocao
Copy link
Contributor

No, gradio 3.15 includes a workaround that works on any version of pillow. In fact, I made that workaround so I know this well. See gradio-app/gradio#2846

@aliencaocao
Copy link
Contributor

Also, Pillow 9.4.0 also includes a fix: python-pillow/Pillow#6811
So if you want to pin pillow version, you should use 9.4.0

@vladmandic
Copy link
Collaborator Author

yes, gradio 3.15 has a workaround for a root cause in pillow - and thanks for that!

also, pillow 9.4.0 does exactly what i did here - explicitly call init() :)

i can either modify pr to upgrade to pillow 9.4.0 and remove that line or leave it as-is.
i'm ok with either option, you pick.

@aliencaocao
Copy link
Contributor

I think you should upgrade to 9.4.0

@AUTOMATIC1111 AUTOMATIC1111 merged commit e991139 into AUTOMATIC1111:master Jan 4, 2023
@vladmandic vladmandic deleted the fix-jpeg branch January 4, 2023 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants