JPEG metadata not correctly stored so that Civitai does not recognize it
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
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
cursed code, but that fixes the swarm side of it