A command-line tool for splitting images into grids and reconstructing them back together
Project description
Tile Image Grid
A command-line tool for splitting images into grids and reconstructing them back together.
Installation
From PyPI
To install the tool via PyPI, use the following command:
pip install tile-image-grid
From Source
To install from source, clone the repository and install the package in editable mode:
git clone https://github.com/passandscore/tile-image-grid.git
cd tile-image-grid
pip install -e .
Usage
The tool provides two main commands for image grid manipulation: Split and Reconstruct.
1. Split Images
Splits an image into a grid of smaller images.
tile-image-grid split [OPTIONS] INPUT_PATH
Arguments:
INPUT_PATH: The path to the input image file.
Options:
-o, --output-dir TEXT: The output directory for split images (default:output).-g, --grid-size INT: The size of the grid (e.g.,3for a 3x3 grid) (default:3).--help: Display help information.
Examples:
-
Split image into a 3x3 grid:
tile-image-grid split input.jpg -o tiles -g 3
-
Split image into a 4x4 grid with a custom output directory:
tile-image-grid split input.jpg -o custom_output -g 4
2. Reconstruct Images
Reconstructs a full image from a directory of image tiles.
tile-image-grid reconstruct [OPTIONS] INPUT_FOLDER OUTPUT_PATH
Arguments:
INPUT_FOLDER: The directory containing the image tiles.OUTPUT_PATH: The path where the reconstructed image will be saved.
Options:
-b, --border-thickness INT: The thickness of the border in pixels (default:2).-c, --border-color INT...: The border color in RGB format (default:0 0 0).--help: Display help information.
Examples:
-
Reconstruct image with a 2px border:
tile-image-grid reconstruct tiles output.jpg -b 2 -c 255 255 255
-
Basic reconstruction without a border:
tile-image-grid reconstruct tiles output.png
-
Reconstruction with a custom border thickness:
tile-image-grid reconstruct tiles output.png -b 3
-
Reconstruction with a red border:
tile-image-grid reconstruct tiles output.png -b 2 -c 255 0 0
File Naming Convention
When splitting images, the tool creates files named in the following format:
0_0.png(top-left tile)0_1.png(top-middle tile)1_0.png(middle-left tile)
The first number represents the row, and the second number represents the column.
Requirements
The following dependencies are required:
- Python 3.7 or higher
- Pillow (PIL)
- Click
- PyTorch (for advanced features)
To install the required dependencies, use:
pip install -r requirements.txt
Common Issues
1. Missing Dependencies
If you encounter errors related to missing dependencies, ensure that all required packages are installed:
pip install -r requirements.txt
2. Permission Issues
If you face permission errors while saving files, ensure you have write permissions for the specified output directory.
Contributing
Contributions are welcome! If you would like to contribute, please submit a Pull Request.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tile_image_grid-0.1.0.tar.gz.
File metadata
- Download URL: tile_image_grid-0.1.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90101fd438a35e38780850218e0a7e50ef8eb1eed7471134cd83e4c7d4bafbf0
|
|
| MD5 |
a562cc8d98089eca3c224b79e4a29ac4
|
|
| BLAKE2b-256 |
398df3afcc826b11b5cdddc65fa049662111a3d9f9b38673841ead77f975d0d8
|
File details
Details for the file tile_image_grid-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tile_image_grid-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf901a2d52a4b7eb4ee24776e73e2842bab60286c0c14658448af4f228542da4
|
|
| MD5 |
31cacdc9eb6fbecbacae0b49b479ecdf
|
|
| BLAKE2b-256 |
14b3ea659a93345f8c57daabfe1c23c890c2f6528aafbfc71a348447ef2d7a55
|