Join the conversation

Join the community of Machine Learners and AI enthusiasts.

Sign Up
prithivMLmods 
posted an update 15 days ago
Post
4013
GRID-6X : Layout for Seamless Image Assembly 🔥

🪨Demo: prithivMLmods/GRID-6X
🪨Doc / Blog: https://huggingface.co/blog/prithivMLmods/grid-6x

In the infer function:
grid_img = Image.new('RGB', (width * grid_size_x, height * grid_size_y))
for i, img in enumerate(result.images[:num_images]):
    grid_img.paste(img, (i % grid_size_x * width, i // grid_size_x * height))

1. **Image Initialization**: grid_img is a blank canvas that will hold the images in a grid format.
2. **Image Placement**: Images are pasted onto the canvas using a loop:
- **Horizontal Position**: (i % grid_size_x) * width calculates the x-coordinate.
- **Vertical Position**: (i // grid_size_x) * height calculates the y-coordinate.

1. **Grid Size Selection**: The user selects the grid size from options like "2x1", "1x2", "2x2", "2x3", "3x2", and "1x1". Each option corresponds to the arrangement of images:
- **2x1**: 2 images in a single row
- **1x2**: 1 image in two rows (column layout)
- **2x2**: 2 rows with 2 images each
- **2x3**: 2 rows with 3 images each
- **3x2**: 3 rows with 2 images each
- **1x1**: A single image (default)

2. **Image Generation**: Based on the grid size selection, the app calculates the number of images to generate. For example:
- If the grid size is "2x2", the app generates 4 images.
- For "3x2", it generates 6 images.

-> Each option arranges images accordingly, providing flexibility in viewing multiple images in one output.

-> Added both of these spaces that support the GRID functionality Layout for Seamless Image Assembly :

----------
🔥IMAGINEO-4K: prithivMLmods/IMAGINEO-4K

🔥GRID-6X: prithivMLmods/GRID-6X
----------
.
.
.@prithivMLmods 🤗
In this post