Skip to content

Commit a483bc1

Browse files
committed
Initial commit: placeholders / initial work building the script itself
0 parents  commit a483bc1

File tree

6 files changed

+176
-0
lines changed

6 files changed

+176
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.vscode/

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2022 Alex "mcmonkey" Goodwin
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Stable Diffusion Infinity Grid Generator
2+
3+
Extension for the [AUTOMATIC1111 Stable Diffusion WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) that generates infinite-dimensional grids.
4+
5+
- [#Examples](Examples)
6+
- [#Installation](Installation)
7+
- [#Usage](Usage)
8+
- [#License](License)
9+
10+
### Examples
11+
12+
TODO
13+
14+
### Installation
15+
16+
- You must have the [AUTOMATIC1111 Stable Diffusion WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) already installed and working. Refer to that project's readme for help with that.
17+
- Open the WebUI, go to to the `Extensions` tab.
18+
- Click on `Install from URL`
19+
- Copy/paste this project's URL into the `URL for extension's git repository` textbox: `https://github.com/mcmonkeyprojects/sd-infinity-grid-generator-script`
20+
- Click `Install`
21+
- Restart or reload the WebUI
22+
23+
### Usage
24+
25+
Usage comes in three main steps:
26+
- 1: Build a grid definition
27+
- 2: Generate its contents
28+
- 3: Make use of the generated output viewer
29+
30+
#### 1: Grid Definition File
31+
32+
TODO
33+
34+
#### 2: Grid Content Generation via WebUI
35+
36+
- Open the WebUI
37+
- Go to the `txt2img` or `img2img` tab
38+
- At the bottom of the page, find the `Script` selection box, and select `Generate Infinite-Axis Grid`
39+
- Select options at will. You can hover over each option for extra usage information.
40+
- Select your grid definition file from earlier.
41+
- Hit your `Generate` button, and wait.
42+
43+
#### 3: Using The Output
44+
45+
TODO
46+
47+
----------------------
48+
49+
### Licensing pre-note:
50+
51+
This is an open source project, provided entirely freely, for everyone to use and contribute to.
52+
53+
If you make any changes that could benefit the community as a whole, please contribute upstream.
54+
55+
### The short of the license is:
56+
57+
You can do basically whatever you want, except you may not hold any developer liable for what you do with the software.
58+
59+
### The long version of the license follows:
60+
61+
The MIT License (MIT)
62+
63+
Copyright (c) 2022 Alex "mcmonkey" Goodwin
64+
65+
Permission is hereby granted, free of charge, to any person obtaining a copy
66+
of this software and associated documentation files (the "Software"), to deal
67+
in the Software without restriction, including without limitation the rights
68+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
69+
copies of the Software, and to permit persons to whom the Software is
70+
furnished to do so, subject to the following conditions:
71+
72+
The above copyright notice and this permission notice shall be included in all
73+
copies or substantial portions of the Software.
74+
75+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
76+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
77+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
78+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
79+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
80+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
81+
SOFTWARE.

assets/short_example.yml

Whitespace-only changes.

javascript/infinity_grid.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Stable Diffusion Infinity Grid Generator
3+
*
4+
* Author: Alex 'mcmonkey' Goodwin
5+
*
6+
* GitHub URL: https://github.com/mcmonkeyprojects/sd-infinity-grid-generator-script
7+
* Created: 2022/12/08
8+
* Last updated: 2022/12/08
9+
*
10+
* For usage help, view the README.md file in the extension root, or via the GitHub page.
11+
*
12+
*/
13+
14+
// Title injection code referenced from d8ahazard's Dreambooth extension
15+
ex_titles = titles;
16+
17+
new_titles = {
18+
"Save Grid Images As JPEG": "If checked, images in the infinity grid will be simple JPEG files. These use less space, but will be missing metadata. If unchecked, images will be PNG files, which have metadata or other custom settings, at the cost of using much more filespace.",
19+
"Select grid definition file": "Select the grid definition yaml file, in your '(extension)/assets' folder. Refer to the README for info."
20+
}
21+
22+
ex_titles = Object.assign({}, ex_titles, new_titles);
23+
titles = ex_titles;

scripts/infinity_grid.py

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
##################
2+
# Stable Diffusion Infinity Grid Generator
3+
#
4+
# Author: Alex 'mcmonkey' Goodwin
5+
# GitHub URL: https://github.com/mcmonkeyprojects/sd-infinity-grid-generator-script
6+
# Created: 2022/12/08
7+
# Last updated: 2022/12/08
8+
#
9+
# For usage help, view the README.md file in the extension root, or via the GitHub page.
10+
#
11+
##################
12+
13+
import modules.scripts as scripts
14+
import gradio as gr
15+
import os
16+
import glob
17+
18+
from modules import images
19+
from modules.processing import process_images, Processed
20+
from modules.processing import Processed
21+
from modules.shared import opts, cmd_opts, state
22+
23+
INF_GRID_README = "https://github.com/mcmonkeyprojects/sd-infinity-grid-generator-script"
24+
25+
class GridFileHelper:
26+
27+
def getNameList():
28+
return glob.glob(scripts.basedir() + "/assets/*.yml")
29+
30+
class Script(scripts.Script):
31+
32+
def title(self):
33+
return "Generate Infinite-Axis Grid"
34+
35+
def show(self, is_img2img):
36+
return True
37+
38+
39+
def ui(self, is_img2img):
40+
help_info = gr.Label(label=f"Confused/new? View <a href=\"{INF_GRID_README}\">the README</a> for usage instructions.")
41+
use_jpg = gr.Checkbox(value=True, label="Save Grid Images As JPEG")
42+
grid_file = gr.Dropdown(value=None,label="Select grid definition file", choices=GridFileHelper.getNameList())
43+
# TODO
44+
return [help_info, use_jpg, grid_file]
45+
46+
47+
def run(self, p, use_jpg, grid_file):
48+
# TODO
49+
proc = process_images(p)
50+
return proc

0 commit comments

Comments
 (0)