Update: Bugfix - Embeddings didn't make it into translation on some newer images. On a related note: Civitai nowadays adds the names of used resources for new images, so some of the following is obsolete. Still a useful script...
Purpose: I like to save AI-images, to drop them later into A1111 and play with the used Loras/Styles. However, the Civitai-Generator doesn't offer Meta-Data in the format A1111 is used to, so it's quite a effort to set everything up. With help of Civitai-API I wrote a little extension, that helps with that.
Usage: Unzip the extension into your Extensions folder and restart the UI. A new Button appears. Drop an image into the prompt-area. Hit the new button (1) under "Generate". Hit the good old apply-button (2), hit Generate and see (or read) what happens.

What happens:
Let's take for example: https://civitai.com/images/8010475 (and leave a thumbs up, while you're there). If you'd save it and drop it into the prompt area, you can see, it has the following info...
[{"type":"checkpoint","modelVersionId":290??0},{"type":"lora","weight":1,"modelVersionId":349887},{"type":"embed","weight":1,"modelVersionId":5637}]
... which A1111 and Forge totally ignore. The overall Prompt is used, but the Checkpoint and the Loras are lost, even if they are installed. Hitting the new translate button, my script asks the Civitai-Api for a little more Info to convert it to a format the "Apply" button understands
After the # you get a "ready to paste" URL to open the models on Civitai, in case you don't have the model installed(currently I can't check if you have, so the URL is always included). By default A1111 ignores everything in a line after a "#" when it comes to generation, so you can just ignore it, if you don't need the URLs.
On top it adds "RNG:CPU", which comes closer to the Civitai's style than RNG:NV or RNG:GPU.
After this, hit "Apply", like usual and "Generate" now has a chance to find the the correct loras/models. If it doesn't find the models, despite them being in your folders, check if the filename is correct in the <angle brackets:1>. Sometimes files get renamed and that's enough for A1111 and forge to skip over them (sometimes even over all included Lora's). Still trying to figure out, how to circumvent that.
Limitations:
A) You will not get the exact same picture, just pretty close. Differences in Hardware and Software-versions as well as Civitai's "behind the scenes magic/optimizations" will always make at least a tiny difference (You can experiment to set the CFG/Guidance a little higher, in my experiments +1.5 or +2.5 get the results often a little closer, but that seems to be random as well). However for me the important thing, is to use pictures as an archive for interesting styles, so this is only making sure, that I have the right ingredients together.
B) It will only work for Images created with the Civitai-Generator.
C) Updates/Changes in the Api might break this little script in no time.
D) If a resource is gone from Civitai, my script and the Api will be probably of no use.
E) If your Web UI is set to remove styles on "apply", the whole procedure will probably be useless.
Description
Small update: Extension sometimes used "trainingdata.zip" instead of the lora-name. Added a little workaround. Adds comment with the full name is written after the prompt, just in case the hash-search doesn't work. Bugfix: The new Version added a problem if a Checkpoint with baked in VAEs.
