RupertAvery / DiffusionToolkit

Metadata-indexer and Viewer for AI-generated images
MIT License
738 stars 46 forks source link

[BUG] Metadata is shown in chinese #253

Open acorderob opened 2 weeks ago

acorderob commented 2 weeks ago

Describe the bug After updating to v1.7 the metadata is shown in chinese characters. Probably a wrong encoding detection when reading the jpg exif metadata.

Version: 1.7

Tool: forge or reforge.

To Reproduce Just updating to 1.7

Expected behavior Metadata should be read correctly.

Affected Image(s)

Screenshots This is how it shows it: image

This is the start of the image file. image

Additional context

Dexth67 commented 2 weeks ago

I have the same issue, but using ConfyUI.

evanerichards commented 2 weeks ago

I'm experiencing this same issue. It seems like it's happening with Auto1111 prompts, both SDXL and 1.5.

Aamir3d commented 2 weeks ago

Same issue so not creating a new ticket. image

RupertAvery commented 2 weeks ago

@acorderob , I will need an actual image, if you can attach them here, github does not remove metadata. If they are nsfw, please give me a link where I can download them.

acorderob commented 2 weeks ago

00017-sdxlNuclearGeneralPurposeV3Semi_v30-DPM++ 2M Karras-S30-C30-CS2-3261352871-3840x2160-17056659

acorderob commented 2 weeks ago

To be sure I just checked the database and everything is fine there. The problem is just on the interface, but then i don't quite understand why it doesn't happen with all images.

Aamir3d commented 2 weeks ago

This image has Chinese characters in the prompt display 00205-3334551669 0-rave against the machine, splash art, wallpaper, WLOP, full focus, professional, highly detailed, perfect lighting; Digital Illu

This image displays a regular prompt 00149-2345574745-Super sharp Environmental shot of  white and grey Cyborg in a cluttered and messy shack, sci fi spare parts in background  vibra

Not sure if it's related but I just noticed text2image outputs have normal prompts, but images image-image from have Chinese prompts. However, also get these characters in Comfy (using the SD Prompt save node).

RupertAvery commented 2 weeks ago

I've discovered the issue, looks like a fix I made for a previous bug also showing Chinese characters broke previously working images.

It's to do with the encoding. Some generators use BigEndian Unicode and other use plain Unicode. The library I use really doesn't have a way to distinguish between them really, but I have a sort of workaround for it.

You can try this build until I have a proper release (no real difference, the Github build is actually what I post)

https://github.com/RupertAvery/DiffusionToolkit/actions/runs/10564220981/artifacts/1855660709

acorderob commented 2 weeks ago

This version works, thanks. I find it odd that the saving of the images do not add a proper BOM in the EXIF metadata. Maybe something to ask in the WebUIs discussion boards.

Edit: i spoke too soon. In this version the detection of new images does not work.

RupertAvery commented 2 weeks ago

Perhaps the latest version should fix new images not being detected

https://github.com/RupertAvery/DiffusionToolkit/actions/runs/10570167410/artifacts/1857454833

Aamir3d commented 2 weeks ago

@RupertAvery thank you - the latest version has correct prompt display and can add images.