Skip to content

Commit a0b6654

Browse files
author
Lincoln Stein
committed
updated postprocessing, prompts, img2img and web docs
1 parent 00cb8a0 commit a0b6654

14 files changed

Lines changed: 95 additions & 326 deletions

File tree

docs/CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ sections describe what's new for InvokeAI.
494494
[Manual Installation](installation/020_INSTALL_MANUAL.md).
495495
- The ability to save frequently-used startup options (model to load, steps,
496496
sampler, etc) in a `.invokeai` file. See
497-
[Client](features/CLI.md)
497+
[Client](deprecated/CLI.md)
498498
- Support for AMD GPU cards (non-CUDA) on Linux machines.
499499
- Multiple bugs and edge cases squashed.
500500

@@ -617,7 +617,7 @@ sections describe what's new for InvokeAI.
617617
- `dream.py` script renamed `invoke.py`. A `dream.py` script wrapper remains for
618618
backward compatibility.
619619
- Completely new WebGUI - launch with `python3 scripts/invoke.py --web`
620-
- Support for [inpainting](features/INPAINTING.md) and
620+
- Support for [inpainting](deprecated/INPAINTING.md) and
621621
[outpainting](features/OUTPAINTING.md)
622622
- img2img runs on all k\* samplers
623623
- Support for
@@ -629,7 +629,7 @@ sections describe what's new for InvokeAI.
629629
using facial reconstruction, ESRGAN upscaling, outcropping (similar to DALL-E
630630
infinite canvas), and "embiggen" upscaling. See the `!fix` command.
631631
- New `--hires` option on `invoke>` line allows
632-
[larger images to be created without duplicating elements](features/CLI.md#this-is-an-example-of-txt2img),
632+
[larger images to be created without duplicating elements](deprecated/CLI.md#this-is-an-example-of-txt2img),
633633
at the cost of some performance.
634634
- New `--perlin` and `--threshold` options allow you to add and control
635635
variation during image generation (see
@@ -638,7 +638,7 @@ sections describe what's new for InvokeAI.
638638
of images and tweaking of previous settings.
639639
- Command-line completion in `invoke.py` now works on Windows, Linux and Mac
640640
platforms.
641-
- Improved [command-line completion behavior](features/CLI.md) New commands
641+
- Improved [command-line completion behavior](deprecated/CLI.md) New commands
642642
added:
643643
- List command-line history with `!history`
644644
- Search command-line history with `!search`
3.95 MB
Loading
310 KB
Loading
8.27 MB
Loading
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,14 @@ Here are the invoke> command that apply to txt2img:
205205
| `--seamless` | | `False` | Activate seamless tiling for interesting effects |
206206
| `--seamless_axes` | | `x,y` | Specify which axes to use circular convolution on. |
207207
| `--log_tokenization` | `-t` | `False` | Display a color-coded list of the parsed tokens derived from the prompt |
208-
| `--skip_normalization` | `-x` | `False` | Weighted subprompts will not be normalized. See [Weighted Prompts](./OTHER.md#weighted-prompts) |
208+
| `--skip_normalization` | `-x` | `False` | Weighted subprompts will not be normalized. See [Weighted Prompts](../features/OTHER.md#weighted-prompts) |
209209
| `--upscale <int> <float>` | `-U <int> <float>` | `-U 1 0.75` | Upscale image by magnification factor (2, 4), and set strength of upscaling (0.0-1.0). If strength not set, will default to 0.75. |
210210
| `--facetool_strength <float>` | `-G <float> ` | `-G0` | Fix faces (defaults to using the GFPGAN algorithm); argument indicates how hard the algorithm should try (0.0-1.0) |
211211
| `--facetool <name>` | `-ft <name>` | `-ft gfpgan` | Select face restoration algorithm to use: gfpgan, codeformer |
212212
| `--codeformer_fidelity` | `-cf <float>` | `0.75` | Used along with CodeFormer. Takes values between 0 and 1. 0 produces high quality but low accuracy. 1 produces high accuracy but low quality |
213213
| `--save_original` | `-save_orig` | `False` | When upscaling or fixing faces, this will cause the original image to be saved rather than replaced. |
214-
| `--variation <float>` | `-v<float>` | `0.0` | Add a bit of noise (0.0=none, 1.0=high) to the image in order to generate a series of variations. Usually used in combination with `-S<seed>` and `-n<int>` to generate a series a riffs on a starting image. See [Variations](./VARIATIONS.md). |
215-
| `--with_variations <pattern>` | | `None` | Combine two or more variations. See [Variations](./VARIATIONS.md) for now to use this. |
214+
| `--variation <float>` | `-v<float>` | `0.0` | Add a bit of noise (0.0=none, 1.0=high) to the image in order to generate a series of variations. Usually used in combination with `-S<seed>` and `-n<int>` to generate a series a riffs on a starting image. See [Variations](../features/VARIATIONS.md). |
215+
| `--with_variations <pattern>` | | `None` | Combine two or more variations. See [Variations](../features/VARIATIONS.md) for now to use this. |
216216
| `--save_intermediates <n>` | | `None` | Save the image from every nth step into an "intermediates" folder inside the output directory |
217217
| `--h_symmetry_time_pct <float>` | | `None` | Create symmetry along the X axis at the desired percent complete of the generation process. (Must be between 0.0 and 1.0; set to a very small number like 0.0001 for just after the first step of generation.) |
218218
| `--v_symmetry_time_pct <float>` | | `None` | Create symmetry along the Y axis at the desired percent complete of the generation process. (Must be between 0.0 and 1.0; set to a very small number like 0.0001 for just after the first step of generation.) |
@@ -257,7 +257,7 @@ additional options:
257257
by `-M`. You may also supply just a single initial image with the areas
258258
to overpaint made transparent, but you must be careful not to destroy
259259
the pixels underneath when you create the transparent areas. See
260-
[Inpainting](./INPAINTING.md) for details.
260+
[Inpainting](INPAINTING.md) for details.
261261

262262
inpainting accepts all the arguments used for txt2img and img2img, as well as
263263
the --mask (-M) and --text_mask (-tm) arguments:
@@ -297,7 +297,7 @@ invoke> a piece of cake -I /path/to/breakfast.png -tm bagel 0.6
297297

298298
You can load and use hundreds of community-contributed Textual
299299
Inversion models just by typing the appropriate trigger phrase. Please
300-
see [Concepts Library](CONCEPTS.md) for more details.
300+
see [Concepts Library](../features/CONCEPTS.md) for more details.
301301

302302
## Other Commands
303303

File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/features/IMG2IMG.md

Lines changed: 8 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -4,86 +4,13 @@ title: Image-to-Image
44

55
# :material-image-multiple: Image-to-Image
66

7-
Both the Web and command-line interfaces provide an "img2img" feature
8-
that lets you seed your creations with an initial drawing or
9-
photo. This is a really cool feature that tells stable diffusion to
10-
build the prompt on top of the image you provide, preserving the
11-
original's basic shape and layout.
7+
InvokeAI provides an "img2img" feature that lets you seed your
8+
creations with an initial drawing or photo. This is a really cool
9+
feature that tells stable diffusion to build the prompt on top of the
10+
image you provide, preserving the original's basic shape and layout.
1211

13-
See the [WebUI Guide](WEB.md) for a walkthrough of the img2img feature
14-
in the InvokeAI web server. This document describes how to use img2img
15-
in the command-line tool.
16-
17-
## Basic Usage
18-
19-
Launch the command-line client by launching `invoke.sh`/`invoke.bat`
20-
and choosing option (1). Alternative, activate the InvokeAI
21-
environment and issue the command `invokeai`.
22-
23-
Once the `invoke> ` prompt appears, you can start an img2img render by
24-
pointing to a seed file with the `-I` option as shown here:
25-
26-
!!! example ""
27-
28-
```commandline
29-
tree on a hill with a river, nature photograph, national geographic -I./test-pictures/tree-and-river-sketch.png -f 0.85
30-
```
31-
32-
<figure markdown>
33-
34-
| original image | generated image |
35-
| :------------: | :-------------: |
36-
| ![original-image](https://user-images.githubusercontent.com/50542132/193946000-c42a96d8-5a74-4f8a-b4c3-5213e6cadcce.png){ width=320 } | ![generated-image](https://user-images.githubusercontent.com/111189/194135515-53d4c060-e994-4016-8121-7c685e281ac9.png){ width=320 } |
37-
38-
</figure>
39-
40-
The `--init_img` (`-I`) option gives the path to the seed picture. `--strength`
41-
(`-f`) controls how much the original will be modified, ranging from `0.0` (keep
42-
the original intact), to `1.0` (ignore the original completely). The default is
43-
`0.75`, and ranges from `0.25-0.90` give interesting results. Other relevant
44-
options include `-C` (classification free guidance scale), and `-s` (steps).
45-
Unlike `txt2img`, adding steps will continuously change the resulting image and
46-
it will not converge.
47-
48-
You may also pass a `-v<variation_amount>` option to generate `-n<iterations>`
49-
count variants on the original image. This is done by passing the first
50-
generated image back into img2img the requested number of times. It generates
51-
interesting variants.
52-
53-
Note that the prompt makes a big difference. For example, this slight variation
54-
on the prompt produces a very different image:
55-
56-
<figure markdown>
57-
![](https://user-images.githubusercontent.com/111189/194135220-16b62181-b60c-4248-8989-4834a8fd7fbd.png){ width=320 }
58-
<caption markdown>photograph of a tree on a hill with a river</caption>
59-
</figure>
60-
61-
!!! tip
62-
63-
When designing prompts, think about how the images scraped from the internet were
64-
captioned. Very few photographs will be labeled "photograph" or "photorealistic."
65-
They will, however, be captioned with the publication, photographer, camera model,
66-
or film settings.
67-
68-
If the initial image contains transparent regions, then Stable Diffusion will
69-
only draw within the transparent regions, a process called
70-
[`inpainting`](./INPAINTING.md#creating-transparent-regions-for-inpainting).
71-
However, for this to work correctly, the color information underneath the
72-
transparent needs to be preserved, not erased.
73-
74-
!!! warning "**IMPORTANT ISSUE** "
75-
76-
`img2img` does not work properly on initial images smaller
77-
than 512x512. Please scale your image to at least 512x512 before using it.
78-
Larger images are not a problem, but may run out of VRAM on your GPU card. To
79-
fix this, use the --fit option, which downscales the initial image to fit within
80-
the box specified by width x height:
81-
82-
```
83-
tree on a hill with a river, national geographic -I./test-pictures/big-sketch.png -H512 -W512 --fit
84-
```
85-
86-
## How does it actually work, though?
12+
For a walkthrough of using Image-to-Image in the Web UI, see [InvokeAI
13+
Web Server](./WEB.md#image-to-image).
8714

8815
The main difference between `img2img` and `prompt2img` is the starting point.
8916
While `prompt2img` always starts with pure gaussian noise and progressively
@@ -99,10 +26,6 @@ seed `1592514025` develops something like this:
9926

10027
!!! example ""
10128

102-
```bash
103-
invoke> "fire" -s10 -W384 -H384 -S1592514025
104-
```
105-
10629
<figure markdown>
10730
![latent steps](../assets/img2img/000019.steps.png){ width=720 }
10831
</figure>
@@ -157,17 +80,8 @@ Diffusion has less chance to refine itself, so the result ends up inheriting all
15780
the problems of my bad drawing.
15881

15982
If you want to try this out yourself, all of these are using a seed of
160-
`1592514025` with a width/height of `384`, step count `10`, the default sampler
161-
(`k_lms`), and the single-word prompt `"fire"`:
162-
163-
```bash
164-
invoke> "fire" -s10 -W384 -H384 -S1592514025 -I /tmp/fire-drawing.png --strength 0.7
165-
```
166-
167-
The code for rendering intermediates is on my (damian0815's) branch
168-
[document-img2img](https://github.com/damian0815/InvokeAI/tree/document-img2img) -
169-
run `invoke.py` and check your `outputs/img-samples/intermediates` folder while
170-
generating an image.
83+
`1592514025` with a width/height of `384`, step count `10`, the
84+
`k_lms` sampler, and the single-word prompt `"fire"`.
17185

17286
### Compensating for the reduced step count
17387

@@ -180,21 +94,13 @@ give each generation 20 steps.
18094
Here's strength `0.4` (note step count `50`, which is `20 ÷ 0.4` to make sure SD
18195
does `20` steps from my image):
18296

183-
```bash
184-
invoke> "fire" -s50 -W384 -H384 -S1592514025 -I /tmp/fire-drawing.png -f 0.4
185-
```
186-
18797
<figure markdown>
18898
![000035.1592514025](../assets/img2img/000035.1592514025.png)
18999
</figure>
190100

191101
and here is strength `0.7` (note step count `30`, which is roughly `20 ÷ 0.7` to
192102
make sure SD does `20` steps from my image):
193103

194-
```commandline
195-
invoke> "fire" -s30 -W384 -H384 -S1592514025 -I /tmp/fire-drawing.png -f 0.7
196-
```
197-
198104
<figure markdown>
199105
![000046.1592514025](../assets/img2img/000046.1592514025.png)
200106
</figure>

0 commit comments

Comments
 (0)