IOPaint icon indicating copy to clipboard operation
IOPaint copied to clipboard

[Feature Request] Preserving image metadata

Open Expletive opened this issue 1 year ago • 4 comments

I've started using Lama Cleaner recently and I've been very happy with it's results. I primarily use it to touch up AI generated images, and it's very good for removing extra limbs, fingers, background characters, etc.

However, when I save an image, all the metadata saved with the original image, (prompt, model, generation settings...) are wiped from the new image. I'd like it if there was an option to carry over that metadata, as well as perhaps add additional information indicating the image was post-processed with Lama Cleaner.

Expletive avatar Apr 29 '23 23:04 Expletive

I would like to ask you if you set --output-dir when you use Lama Cleaner? I checked the code and found that if --output-dir is set, it does not save exif(metadadta) information, but when start server without --output-dir exif data should be saved.

Sanster avatar Apr 30 '23 13:04 Sanster

I start lama-cleaner with following command. I do not use the --output-dir option. lama-cleaner --model=lama --device=cuda --port=8080 --enable-interactive-seg --interactive-seg-model=vit_l --interactive-seg-device=cuda The "metadata" I am referring to is "tEXt Textual data" test

Steps to reproduce:

  • I have attached an image containing such data as an example.
  • You can verify that it contains the text with the strings utility
  • strings test.png | head -n 10 | less should produce the following output:
IHDR
tEXtparameters
indoors, garage, spotlight, stage lights, muscle car,  stage, stage curtains, crowd, people,, masterpiece, best quality, (intricate, ultra detailed, 8k, absurdres, detailed background, best shadow, beautiful lighting, dramatic shadows:1.2)
Negative prompt: (jacket), badhandv4 (bad_prompt:0.8) EasyNegative, (worst quality, low quality, monochrome:1.4), (depth of field, blurry, bokeh, shallow depth of field:1.5), (blurry background:1.2)
signature, watermark, username, artist name, censored, cropped, bar censor, text, speech bubble, letterboxed, JPEG artifacts, lowres, bad anatomy, bad hands, cropped, worst quality, low quality, normal quality, 3D, (worst quality, low quality:1.4), (depth of field, blurry:1.4), (greyscale, monochrome:1.2), (bad_prompt:0.8), (censored, censorship:1.3), (text, speech bubble), error, bad anatomy, (bad hands), sketch, multiple views,
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 4051847759, Size: 1024x768, Model hash: 3b9fb23dbe, Model: NEW Super Gekijoban Shinseiki Dai Ranto HLL4p3 You Can (Not) Proompt VIII Epoch HD Remix &IRYS Turbo[ClipFix], Clip skip: 2, ENSD: 31337, ControlNet 0 Enabled: True, ControlNet 0 Preprocessor: softedge_hed, ControlNet 0 Model: control_hed-fp16 [13fee50b], ControlNet 0 Weight: 1, ControlNet 0 Starting Step: 0, ControlNet 0 Ending Step: 1, ControlNet 0 Resize Mode: Crop and Resize, ControlNet 0 Pixel Perfect: True, ControlNet 0 Control Mode: Balanced, ControlNet 0 Preprocessor Parameters: "(512, 64, 64)", SAG Guidance Scale: 0.75, SAG Mask Threshold: 1;
IDATx
?~\;DH
AH4*
1BFJq
  • Open the image with Lama-Cleaner and erase any part of it you like, and save the images.
  • Using the strings utility, verify that the saved file is missing the information the original image contained.
  • strings test_cleanup.png | head -n 10 | less

Expletive avatar Apr 30 '23 22:04 Expletive

2023-05-03_23-41-48

maxiser avatar May 03 '23 20:05 maxiser

2023-05-03_23-41-48

It may be a permission problem https://lama-cleaner-docs.vercel.app/frequently_asked_questions#unrecognized-data-format-error

Sanster avatar May 04 '23 01:05 Sanster