Skip to content

JPEG metadata not correctly stored so that Civitai does not recognize it #735

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

Open
antispam2002 opened this issue Apr 25, 2025 · 1 comment
Labels
Bug Something isn't working

Comments

@antispam2002
Copy link

antispam2002 commented Apr 25, 2025

Your question

When generating images in JPEG format, SwarmUI writes the metadata JSON into "Comments" property which can be inspected e.g. with Windows Explorer. When uploading to Civitai, this information is ignored. BUT - if the image is once opened and saved with e.g. MS Paint, with no changes, then Civitai recognizes the prompt and other generation parameters. SwarmUI, however, cannot read the metadata from this file reporting the following error

11:13:34.916 [Warning] Error reading image metadata for file 'C:/SwarmUI/Output/local/raw/2025-04-21/0936XXX105405116.jpg': Newtonsoft.Json.JsonReaderException: Failed to parse JSON `(Invalid Characters Stripped) `: Unexpected character encountered while parsing value: ?. Path '', line 0, position 0.
   at SwarmUI.Utils.Utilities.ParseToJson(String input) in C:\SwarmUI\src\Utils\Utilities.cs:line 584
   at SwarmUI.Utils.ImageMetadataTracker.GetMetadataFor(String file, String root, Boolean starNoFolders) in C:\SwarmUI\src\Utils\ImageMetadataTracker.cs:line 326

The metadata, however, is still there, and looks - at least visually - absolutely intact. Can SwarmUI write the metadata so that it directly can be parsed by Civitai?

Logs

No response

Other

No response

@antispam2002 antispam2002 added the User Support A user needs help with something, probably not a bug. label Apr 25, 2025
@mcmonkey4eva mcmonkey4eva added Bug Something isn't working and removed User Support A user needs help with something, probably not a bug. labels Apr 30, 2025
@mcmonkey4eva
Copy link
Member

It's probably the weird encoding direction thingy -- iirc there's unfortunately no "correct answer" per se for how it should be done. Rather:

  • Swarm should be able to read the other ordering properly
  • Civitai should be able to as well

So for Swarm reading the reverse order, I'll mark this as a bug to fix - for civitai, you'll have to poke them about it

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

No branches or pull requests

2 participants