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

[BUG] - Incompatible with latest Stable Swarm UI #60

Closed
Shadetail opened this issue Dec 4, 2023 · 8 comments
Closed

[BUG] - Incompatible with latest Stable Swarm UI #60

Shadetail opened this issue Dec 4, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@Shadetail
Copy link

Shadetail commented Dec 4, 2023

Description

It worked with images generated by Stable Swarm until I updated Stable Swarm, then it stopped working.
Also it would be great if it was possible to have option to read raw metadata, for robustness. auto1111 png info does this, and as a result, even an ancient version of png info can read metadata from latest Stable Swarm.

This is its metadata as read by auto1111 PNG Info:

parameters

{
"sui_image_params": {
"prompt": "(3D:1.45) creature, (spiky:1.45) (seashell:0.85) snail, (effervescent:1.5), diffuse clean, (cute animal:1.25), googlyeyes, (colorful swirls:1.15), spikes, vibrant colorful, (embedding :easynegative:1.45), wheel s",
"negativeprompt": "worst quality, low quality:1.4), technology, metal, cybernetic, vehicle, mechanical, fur coat, human, human face, chibi, clothes, attire, suit, gear, equipment, humanoid, shrek",
"images": 6,
"seed": 581626448,
"steps": 25,
"cfgscale": 4.0,
"width": 1024,
"height": 1024,
"initimagecreativity": 0.7,
"model": "SDXL/realcartoonXL_v5.safetensors",
"swarm_version": "0.5.9.0",
"date": "2023-12-01",
"generation_time": "0.00 (prep) and 6.49 (gen) seconds"
}
}

dpi

(96.012, 96.012)

Reproduction steps

No response

Image file

18-12-47-0-581626448

Version

1.3.4

OS

Windows

Tool

StableSwarmUI

@Shadetail Shadetail added the bug Something isn't working label Dec 4, 2023
@receyuki
Copy link
Owner

receyuki commented Dec 6, 2023

It seems like the new version of StableSwarmUI has changed the structure of metadata and is completely incompatible with the old version. I will support the new version asap.

Previous versions of the metadata contained data in both StableSwarmUI format and A1111 format, thus it could be read by both StableSwarmUI and A1111. However, in this version, the StableSwarmUI data has been moved to the location originally reserved for storing A1111 data, therefore it can still be read by A1111, but in an incompatible format.

@receyuki
Copy link
Owner

BTW, I just realised that the JPGs generated by StableSwarmUI only show some mojibake when read by pnginfo. Although I have added a new JPG parser, I think once the author of StableSwarmUI realises this issue, they will once again change the method of storing metadata.

@receyuki
Copy link
Owner

Please try version 1.3.4.post1

@Shadetail
Copy link
Author

I tried version 1.3.4.post1 and it works now! Thank you! ❤

@mcmonkey4eva
Copy link

BTW, I just realised that the JPGs generated by StableSwarmUI only show some mojibake when read by pnginfo. Although I have added a new JPG parser, I think once the author of StableSwarmUI realises this issue, they will once again change the method of storing metadata.
Could you clarify what this means?

@receyuki
Copy link
Owner

@mcmonkey4eva
For instance, this is a JPG generated by StableSwarmUI 0.6.
flying whale, sky, clouds, photorealisti-sd_xl_base_10_09vaesafetensors-162473898
If you read it using A1111's PNG Info:
image

I’ve been using the same module and method as A1111 for reading and writing JPG UserComment, I would like to share some insights that might interest you.

The A1111 utilises piexif for managing UserComment (a module that hasn’t been updated in four years).
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/modules/images.py#L559
And piexif encodes metadata using UTF-16BE and can only read metadata encoded in UTF-16BE.
https://github.com/hMatoba/Piexif/blob/master/piexif/helper.py#L15
But the ImageSharp you are using encodes metadata with System.Text.Encoding.Unicode, which is UTF-16LE.
https://github.com/SixLabors/ImageSharp/blob/main/src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs#L57
If you decide to make the metadata compatible with A1111, you might need to consider using Encoding.BigEndianUnicode to encode it yourself.

@mcmonkey4eva
Copy link

Oh, lol.
If you decide to make the metadata compatible with A1111 that's never been an intended feature target, and even if it was I'd rather submit a PR to auto to fix it than the other way around.
There's also https://github.com/NoCrypt/sd-fast-pnginfo this extension for auto webui which uses exifr and so won't have that problem anyway

@receyuki
Copy link
Owner

I personally agree with your opinion, and this should be considered a legacy issue. I think A1111 should replace piexif with a different library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants