stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

Upscale to jpg does not retain parameters

Open MrKuenning opened this issue 3 years ago • 4 comments

When you use the Extra tab and upscale a PNG file to a larger PNG file it retains the parameters

Original image:

parameters
a tree with a bird
Negative prompt: grass
Steps: 40, Sampler: Euler a, CFG scale: 7, Seed: 968002204, Size: 512x512

Becomes:

parameters
a tree with a bird
Negative prompt: grass
Steps: 40, Sampler: Euler a, CFG scale: 7, Seed: 968002204, Size: 512x512
extras
Upscale: 2, model:Lanczos

However when you upscale a JPG to JPG it changes the metadata.

Original image:

exif comment
a tree with a bird
Negative prompt: grass
Steps: 40, Sampler: Euler a, CFG scale: 7, Seed: 2378972195, Size: 512x512

Becomes:

exif comment
Upscale: 2, model:Lanczos

The same thing happens when you convert a PNG to JPG.

I would expect that upscale to JPG should still store the parameters in the metadata. I realize that the PNG and the JPG store the info differently and in different places. I imagine that it's more common upscale to a JPG as PNG get rather large quickly.

MrKuenning avatar Sep 28 '22 19:09 MrKuenning

jpeg info seems not to be built up from existing_info in the same way the png info is:

https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/041d2aefc082c2883aa7e28ee3e4a990b3be9758/modules/images.py#L372-L379

dfaker avatar Sep 29 '22 02:09 dfaker

PNG is really too big, JPG or WEBP file size is only 1/10 of png. Is there a solution now?

hbl917070 avatar Feb 16 '23 14:02 hbl917070

Would love this as well.

MNeMoNiCuZ avatar Jun 03 '23 16:06 MNeMoNiCuZ