Repository: stable-diffusion-webui
Issue: [Feature Request]: Merge options + Headers for "Prompts from file or textbox" script
Labels: enhancement

### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What would your feature do ?

A feature which allow to merge images into a grid, similar of what you get in x/y plot script.
Reason for this suggestion: Right now its impossible to test multiple prompts with multiple models at the same time to generate a x/y plot style grid.
With this suggestion, users will be able to test anything they want, with all the flexibility "Prompts from file or textbox" script can offer.
Due the nature of the webui scripts, it wouldn't suffice to just allow both "Prompts from file or textbox" and "X/Y/Z plot" as the two differ in its functionality, making both features incompatible to be used together.
This suggestion adds a solution to that problem, allowing Prompts from file or textbox to organize on a grid style the images generated.

Example where the grid is used to tag models, instruction sets (prompts, settings, models, etc):
![image](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/39227035/520cc47f-e256-480a-8459-79baf2ba7cf6)
In this example, the header titles (model1, model2, model3, instructions 1, instructions 2, instructions 3) are fictional, it is just the user decision to name as so these header for each position in the grid, the user can control how to name each position of the grid.

Explanation of composition:
![image](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/39227035/6a2425b1-e258-4cc3-ab20-497a070bf478)

_______________________________________________________
_     _     _     _     _     _     _     _     _     _     _     _     _     _     _     _ 
**Merging, X coordinate:**
The command for merging the resulting images into a collage in a X coordinate would be by using X  instruction right after a comma (,) at the end of an instruction block.
If the X is preceded by a number (numberX), example (3X), the collage will skip 1 image generating placing an empty space in the amount of positions the number equals, if its 3X, the grid will skip 3 spaces of image, leaving an empty space there.
When using only X, it sets the coordinates to 0,0 as the next column of the same row
![image](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/39227035/9b420507-054e-46a6-9da5-05862db4da07)

_     _     _     _     _     _     _     _     _     _     _     _     _     _     _     _ 
**Merging, Y coordinate:**
The command for merging the resulting images into a collage in a Y coordinate would be by using Y instruction right after a comma (,) at the end of an instruction block.
If the Y is preceded by a number (numberY), example (3Y), the collage will skip 1 image generating placing an empty space in the amount of positions the number equals, if its 3Y, the grid will skip 3 spaces of image, leaving an empty space there.
When using Y, it resets the coordinates to 0,0 as the first column of the next row
![image](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/39227035/1b32d422-1c5f-45d5-9e3e-6082e523bc68)
_     _     _     _     _     _     _     _     _     _     _     _     _     _     _     _ 
**Merging, X and Y coordinate:**
The command for merging the resulting images into a collage in a X/Y coordinate would be by using Y or X instruction right after a comma (,) at the end of an instruction block.
X and Y can be used combined in order to add empty spaces for the following image in both X and Y positions, X goes first, then Y, (numberXnumberY), for example 2X3Y would make the next image be positioned in 2 position X (after two empty spaces on X) and 3 positions Y (after three empty spaces on Y). By using numberXnumberY, it sets the X,Y position of the next column (floor) as 0,0
Example:
--prompt"a1"--negative_prompt"a2"--sd_model"model1",X
--prompt"b1"--negative_prompt"b2"--sd_model"model2",2X3Y 
--prompt"c1"--negative_prompt"c2"--sd_model"model3",1X
![image](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/39227035/d6852ba4-8ed5-488f-b651-76315824dff3)

_     _     _     _     _     _     _     _     _     _     _     _     _     _     _     _ 
**Headers of the merge:**
It allow to add a header title to tag each X row and Y column where its used.
Its command is --numberX"text", for example --0X"row 0 name" would add a header title to the row 0 as "row 0 name" string.
This is added at the right at the start of an instruction block collection that would generate a grid.
If an instruction of coordinate header title is duplicate, it will use the last one inserted.
For example: 
--1X"name of 1X" --2Y"abc" --0Y"position 0Y",
--prompt"a1"--negative_prompt"a2"--sd_model"model1",X
--prompt"b1"--negative_prompt"b2"--sd_model"model2",Y1X
--prompt"b1"--negative_prompt"b2"--sd_model"model2",

That would set header titles as the following image:
![image](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/39227035/4a6da531-77f1-447f-b6fc-901a2c65f24e)


### Proposed workflow

1.The user initializes the WebUI
2. Go to Script selector and choose "Prompts from file or textbox"
3. On List of prompt inputs, the user adds the prompt for the image grid them want to generate.
4. The user press generate, the image is generated collecting the images into a single one, similar of what is resulted in the X/Y/Z plot grid.

### Additional information

Examples:

Example just using X: 
--prompt"a1"--negative_prompt"a2"--sd_model"model1",
--prompt"b1"--negative_prompt"b2"--sd_model"model2",X
--prompt"c1"--negative_prompt"c2"--sd_model"model3",1X
--prompt"d1"--negative_prompt"d2"--sd_model"model4",
--prompt"e1"--negative_prompt"e2"--sd_model"model5",

The result would be three images, 
Image 1: will contain just the image result of the instruction set (a):
![image](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/39227035/818aa99b-e2a5-4793-acd8-ce56988768b5)
Image 2: will contain a collection of the separate result of 3 instruction (b,c,d):
![image](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/39227035/d1eeac09-a045-4c7e-af64-d3490d7fdb9a)
Image 3: will contain just the image result of the instruction set (e):
![image](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/39227035/69a4c6a5-6758-408a-a9fc-1688d97bda6c)



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


Example just using Y: 
--prompt"a1"--negative_prompt"a2"--sd_model"model1",
--prompt"b1"--negative_prompt"b2"--sd_model"model2"Y
--prompt"c1"--negative_prompt"c2"--sd_model"model3"1Y
--prompt"d1"--negative_prompt"d2"--sd_model"model4",
--prompt"e1"--negative_prompt"e2"--sd_model"model5",

In this example, the resulting image is a X/Y collage, being Y the columns "floor",
It generates Three images: 
Image 1: will contain just the image result of the instruction set (a):
![image](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/39227035/226f1fd0-c93d-469d-a2c2-05ec064d4186)
Image2: will contain a collection of the separate result of 3 instruction sets (b,c,d):
![image](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/39227035/284a1710-1069-4a11-8ed3-7ab0cdb045c4) 
Image 3: will contain just the image result of the instruction set (e):
![image](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/39227035/7d5e17fd-ab13-434b-8e52-8ba3aca0cb1b)

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


Example using X and Y: 
--prompt"a1"--negative_prompt"a2"--sd_model"model1",
--prompt"b1"--negative_prompt"b2"--sd_model"model2",X
--prompt"c1"--negative_prompt"c2"--sd_model"model3",2X1Y
--prompt"d1"--negative_prompt"d2"--sd_model"model4",X
--prompt"e1"--negative_prompt"e2"--sd_model"model5",Y
--prompt"f1"--negative_prompt"f2"--sd_model"model6",
It generates 2 images: 
Image 1: will contain just the image result of the instruction set (a):
![image](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/39227035/5bf492fa-0461-46c2-b7b6-a17b0b9e6780)
Image2: will contain a collection of the separate result of 5 instruction sets (b,c,d,e,f):
![image](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/39227035/bf0bd342-acc0-4928-9792-c6986be66fab)
Note: The translucent blocks are just for this example, same for the coordinate numbers, its used here as explanation of the tiles moved, in the render the image of for example, image2, would be seen as follow:
![image](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/39227035/9bd41d49-bb03-489b-b7e6-eae0644cded4)
If we were to add to this example, headers we would have to add the instructions of the position for each tag header:
Example:
--0X"m1" --2X"m3" --3X"m3+LoRa" --0Y"Instruction1" --1Y"Instruction2" --2Y"Empty",
--prompt"a1"--negative_prompt"a2"--sd_model"model1",
--prompt"b1"--negative_prompt"b2"--sd_model"model2",X
--prompt"c1"--negative_prompt"c2"--sd_model"model3",2XY
--prompt"d1"--negative_prompt"d2"--sd_model"model4",X
--prompt"e1"--negative_prompt"e2"--sd_model"model5",
![image](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/39227035/9ab7b633-a849-4df8-a651-4ba62ee10d0e)
As you can see, now the final image now has headers, header settings can add empty spaces in case no image occupies such coordinate, X or Y.