# Image to Image

Generate images based on image input

Input image obtained from the Unity camera or external images

Image to image allows you to add new elements for blending for original image

<div><figure><img src="https://1270527639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtVdP5UEfu2PNFw4I6asq%2Fuploads%2FQ701pUebm8QfxumIhShT%2FDemo2DEdited.png?alt=media&#x26;token=3eacc2bb-7dc4-4f8b-b09a-67dbc4021e83" alt=""><figcaption></figcaption></figure> <figure><img src="https://1270527639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtVdP5UEfu2PNFw4I6asq%2Fuploads%2FKpRIa6MQc2XUk63Zi1Ff%2Ffinalimage.png?alt=media&#x26;token=76766389-98ed-4277-b3c1-7c9d558cfbd3" alt=""><figcaption></figcaption></figure></div>

Currently (April 2023), Image to Image also recommends the use of WebUI, as it is possible to use the Inpaint function and other functions that allow partial modifications by using WebUI.

Since stable-diffusion-for-unity runs StableDiffusionWebUI, it is possible to use the WebUI functionality from the local server URL listed in the command prompt started by StartServer from Unity.

<figure><img src="https://1270527639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtVdP5UEfu2PNFw4I6asq%2Fuploads%2FImw5pgKoxGjN6t5kyRHK%2Fwebui.png?alt=media&#x26;token=a841045f-fcad-45bd-a2a9-dd474945b891" alt=""><figcaption><p>local server URL</p></figcaption></figure>

<figure><img src="https://1270527639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtVdP5UEfu2PNFw4I6asq%2Fuploads%2Fy0jjf3NmpaIAse3VCl8m%2Fimage.png?alt=media&#x26;token=d341fd53-b9c1-4e0a-8a22-15d2b0a44b44" alt=""><figcaption><p>WebUI Inpaint</p></figcaption></figure>

For Image2Image on Unity<br>

<figure><img src="https://1270527639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtVdP5UEfu2PNFw4I6asq%2Fuploads%2FUVsjD2yXFx9zrEbR5RwT%2Fimage.png?alt=media&#x26;token=90a9d275-d780-49ff-9665-9e956be3dd47" alt=""><figcaption></figcaption></figure>

For generate image with image to Image, attach the Img2Img.cs component to the object

It is assumed that the local server is up and running.&#x20;

Please refer to the following for StartServer before use.

{% content-ref url="../production-tips/about-local-server" %}
[about-local-server](https://docs.witchpot.com/english/production-tips/about-local-server)
{% endcontent-ref %}

A parameter summary is shown below. Parameters that are adjusted frequently are bolded.

<table><thead><tr><th width="177">Parameter</th><th>Summary</th></tr></thead><tbody><tr><td><strong>ImageSource</strong></td><td>Whether the input element is a prepared image or a camera input in Unity</td></tr><tr><td>Image</td><td>If Texture is selected in ImageSource, select the image to be used as input Details are listed at the bottom of the table</td></tr><tr><td><strong>Prompt</strong></td><td>Enter the words you want to generate in natural language</td></tr><tr><td><strong>NegativePrompt</strong></td><td>Input elements in natural language that you do not want to include in the generated image</td></tr><tr><td><strong>Width</strong></td><td>Width of the generated image in pixels</td></tr><tr><td><strong>Height</strong></td><td>Height of the generated image in pixels</td></tr><tr><td>Steps</td><td>Increase this parameter if the generated image looks blurry</td></tr><tr><td><strong>Cfg Scale</strong></td><td>Strength to follow prompts<br>Input larger value to strongly follow the prompt.</td></tr><tr><td>Denoising Strength</td><td>How strongly follow the input image<br>If you want to change the input image only slightly, decrease the value. If you want to change the image significantly, increase the value.</td></tr><tr><td>Seed</td><td><p>Fixing the seed value to generate a similar image</p><p>In case of -1, the image will be random</p></td></tr><tr><td>Batch Count</td><td><p>The number of images to be generated.</p><p>Select 1 to 100 images.</p><p>Generated images will be stored in StreamingAssets/StableDiffusion. Please check images by date sort in the explorer.</p></td></tr><tr><td>ExportType</td><td><p>Selectable output types: PNG, JPG, TGA</p><p>Apply to Image, RawImage, Material, etc</p></td></tr><tr><td>Sampler</td><td>Changing the nuances of the generated image</td></tr><tr><td><strong>Model</strong></td><td>Base trained model<br>See the "<a href="../production-tips/switch-models-lora">Switch Models/LoRA</a>" to switch new model</td></tr><tr><td><strong>Lora</strong></td><td><p>Additional trained Lora to generate consitent specific pattern image</p><p>See the "<a href="../production-tips/switch-models-lora">Switch Models/LoRA</a>" to switch new LoRA</p><p>If you select Lora, &#x3C;lora:filename:1>will be added to the Prompt and LoRA will be available</p></td></tr></tbody></table>

Settings when Texture is selected as input&#x20;

Check >Read/Write in ImportSettings of the image.

<figure><img src="https://1270527639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtVdP5UEfu2PNFw4I6asq%2Fuploads%2FAfa2oG6tflUegGvKrxVM%2Fimage.png?alt=media&#x26;token=965609ce-e828-4f28-a843-af8953636afe" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.witchpot.com/english/components/image-to-image.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
