light-and-ray / sd-webui-replacer

A tab for sd-webui for replacing objects in pictures or videos using detection prompt
209 stars 11 forks source link

Batch from Directory - Keep original filename #4

Closed mythicalixx closed 10 months ago

mythicalixx commented 11 months ago

Even though "Use original name for output filename during batch process in extras tab" is checked, when using Batch from Directory within this extension, it will not keep the original filenames from the input directory for the output files, but name them "0000-12345" etc. I would really appreciate it if it could keep the original filename instead, like the Extras tab does.

light-and-ray commented 11 months ago

If you say about new webui 1.7.0 option for keeping filenames, I found it has 2 problems:

I made an issue for it, but for now nobody has responded: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/14344 I hope they will fix it, unless I dislike this option

However, I understand this feature would be useful, and will add checkbox inside my extension to keep filenames

mythicalixx commented 11 months ago

Yeah actually I need this feature because it overrides the original file, so that is how I want it. Any chance you can send over some tempoary fix to make this happen quickly while we wait for official update, I need this for production use. Thank you.

light-and-ray commented 11 months ago

No, I can't. I'm planning to update in January maybe. And I will do it in the best way, not like hot patch

The purpose of my extension is only to automate inpainting in dedicated ui tab. Why you use it in production, for it it is better to use api based software. I think comfy with api and its segment anything extension in your software. I heard in comfy you can export workflow in api format, and use it via api

mythicalixx commented 11 months ago

I figured the relevant code is in extensions\sd-webui-replacer\scripts\replacer_generate.py. There is this line:

for image in images: generateSingle(image, gArgs, saveDir, "", save_to_dirs)

We need to modify it that it keeps the original file name. We can put custom string in "". Someone know more?

light-and-ray commented 11 months ago

"" - is suffix, adds to end of file name. E.g. "-hiresfix". Keeping original filenames is not just a single-line patch, you need to do enough work

light-and-ray commented 10 months ago

implemented as suffix