AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
139.71k stars 26.48k forks source link

[Bug]: [Solved] SyntaxError: not a TIFF file (header b"b'Exif\\x" not valid) #11126

Open pakresi opened 1 year ago

pakresi commented 1 year ago

What happened?

@AUTOMATIC1111 AUTOMATIC1111 said v.1.3.2 "fix postprocessing overwriting parameters"

Problem Details:

In extras tab, when you upload jpg and u are generating back png. jpg files have exif info png does not. So new version writing exif data to png files. When saving png it must pass existing exif argument After version v.1.3.0 there are tons of exif promlems in png files.

- Solution1:

use v.1.3.0

- Solution2:

if you have newer version v.1.3.0 in modules/images.py (find save_image_with_geninfo function)

change

            for k, v in (existing_pnginfo or {}).items():
                pnginfo_data.add_text(k, str(v))

lines like that (be careful about spaces)

            for k, v in (existing_pnginfo or {}).items():
                if(k.lower() == "exif") : continue
                pnginfo_data.add_text(k, str(v))

solving problem. Maybe someone fix this with a new version.

Still have problem?

Steps to reproduce the problem

  1. upload jpg file to extras tab
  2. create png and save computer
  3. upload png to anywhere in webui
royalaid commented 1 year ago

Just a heads up I ran into the same issue, but with img2img. I fixed it by commenting out https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/modules/img2img.py#L51, the line that reads:

        img = ImageOps.exif_transpose(img)
a373648449 commented 11 months ago

The exception has been solved using this method,nice.
for k, v in (existing_pnginfo or {}).items(): if(k.lower() == "exif") : continue pnginfo_data.add_text(k, str(v))