You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This script also provides an img2img feature that lets you seed your
124
-
creations with a drawing or photo. This is a really cool feature that tells
125
-
stable diffusion to build the prompt on top of the image you provide, preserving
126
-
the original's basic shape and layout. To use it, provide the --init_img
127
-
option as shown here:
152
+
creations with an initial drawing or photo. This is a really cool
153
+
feature that tells stable diffusion to build the prompt on top of the
154
+
image you provide, preserving the original's basic shape and
155
+
layout. To use it, provide the --init_img option as shown here:
128
156
129
157
```
130
158
dream> "waterfall and rainbow" --init_img=./init-images/crude_drawing.png --strength=0.5 -s100 -n4
131
159
```
132
160
133
-
The --init_img (-I) option gives the path to the seed picture. --strength (-f) controls how much
134
-
the original will be modified, ranging from 0.0 (keep the original intact), to 1.0 (ignore the original
135
-
completely). The default is 0.75, and ranges from 0.25-0.75 give interesting results.
161
+
The --init_img (-I) option gives the path to the seed
162
+
picture. --strength (-f) controls how much the original will be
163
+
modified, ranging from 0.0 (keep the original intact), to 1.0 (ignore
164
+
the original completely). The default is 0.75, and ranges from
165
+
0.25-0.75 give interesting results.
136
166
137
-
You may also pass a -v<count> option to generate count variants on the original image. This is done by
138
-
passing the first generated image back into img2img the requested number of times. It generates interesting
167
+
You may also pass a -v<count> option to generate count variants on the
168
+
original image. This is done by passing the first generated image back
169
+
into img2img the requested number of times. It generates interesting
139
170
variants.
140
171
172
+
If the initial image contains transparent regions, then Stable
173
+
Diffusion will only draw within the transparent regions, a process
174
+
called "inpainting". However, for this to work correctly, the color
175
+
information underneath the transparent needs to be preserved, not
176
+
erased. See [Creating Transparent Images for
177
+
Inpainting](#creating-transparent-images-for-inpainting) for details.
178
+
141
179
## Seamless Tiling
142
180
143
-
The seamless tiling mode causes generated images to seamlessly tile with itself. To use it, add the --seamless option when starting the script which will result in all generated images to tile, or for each dream> prompt as shown here:
181
+
The seamless tiling mode causes generated images to seamlessly tile
182
+
with itself. To use it, add the --seamless option when starting the
183
+
script which will result in all generated images to tile, or for each
184
+
dream> prompt as shown here:
185
+
144
186
```
145
187
dream> "pond garden with lotus by claude monet" --seamless -s100 -n4
146
188
```
@@ -774,6 +816,49 @@ of branch>
774
816
You will need to go through the install procedure again, but it should
775
817
be fast because all the dependencies are already loaded.
776
818
819
+
# Creating Transparent Regions for Inpainting
820
+
821
+
Inpainting is really cool. To do it, you start with an initial image
822
+
and use a photoeditor to make one or more regions transparent
823
+
(i.e. they have a "hole" in them). You then provide the path to this
824
+
image at the dream> command line using the -I switch. Stable Diffusion
825
+
will only paint within the transparent region.
826
+
827
+
There's a catch. In the current implementation, you have to prepare
828
+
the initial image correctly so that the underlying colors are
829
+
preserved under the transparent area. Many imaging editing
830
+
applications will by default erase the color information under the
831
+
transparent pixels and replace them with white or black, which will
832
+
lead to suboptimal inpainting. You also must take care to export the
833
+
PNG file in such a way that the color information is preserved.
834
+
835
+
If your photoeditor is erasing the underlying color information,
836
+
dream.py will give you a big fat warning. If you can't find a way to
837
+
coax your photoeditor to retain color values under transparent areas,
838
+
then you can combine the -I and -M switches to provide both the
839
+
original unedited image and the masked (partially transparent) image:
840
+
841
+
~~~~
842
+
dream> man with cat on shoulder -I./images/man.png -M./images/man-transparent.png
843
+
~~~~
844
+
845
+
We are hoping to get rid of the need for this workaround in an
846
+
upcoming release.
847
+
848
+
## Recipe for GIMP
849
+
850
+
GIMP is a popular Linux photoediting tool.
851
+
852
+
1. Open image in GIMP.
853
+
2. Layer->Transparency->Add Alpha Channel
854
+
2. Use lasoo tool to select region to mask
855
+
3. Choose Select -> Float to create a floating selection
856
+
4. Open the Layers toolbar (^L) and select "Floating Selection"
857
+
5. Set opacity to 0%
858
+
6. Export as PNG
859
+
7. In the export dialogue, Make sure the "Save colour values from
860
+
transparent pixels" checkbox is selected.
861
+
777
862
# Contributing
778
863
779
864
Anyone who wishes to contribute to this project, whether
0 commit comments