Skip to main content

split-image

Downloads Downloads

Quickly split an image into rows and columns (tiles).

split-image is a Python package that you can use from the command line to split an image into tiles.

Installation

pip install split-image

Usage

From the command line:

split-image [-h] [-s] image_path rows cols

As a regular module import:

from split_image import split_image

split_image(image_path, rows, cols, should_square, should_cleanup, [output_dir])
# e.g. split_image("bridge.jpg", 2, 2, True, False)

Basic examples

split-image cat.png 2 2

This splits the cat.png image in 4 tiles (2 rows and 2 columns).

split-image bridge.png 3 4 -s

This splits the bridge.png image in 12 tiles (3 rows and 4 columns). The -square arguments resizes the image into a square before splitting it. The background color used to fill the square is determined from the image automatically.

Other options

Reverse split:

split-image cat.jpg 2 2 -r

Will attempt to merge similarly named image tiles to one image. So, if you have these images in the current directory:

  • cat_0.jpg
  • cat_1.jpg
  • cat_2.jpg
  • cat_3.jpg

they will be merged according to their file name:

Directory batch process:

split-image image_dir 4 2

Will split all images contained in the image_dir folder.

Cleanup:

split-image test.jpg 4 2 --cleanup

Will delete the original image after the process.

Large images:

split-image test.jpg 4 2 --load-large-images

When working with large images (over 178,956,970 pixels), you may get an error. Pass this flag to override this.

Assign output folder:

split-image test.jpg 2 2 --output-dir <dir-name>

Set the output directory for image tiles (e.g. 'outp/images'). Defaults to the current working directory.

Quiet mode:

split-image test.jpg 3 4 --quiet

Will suppress all log messages (except errors and warnings) when running.

Arguments list:


positional arguments:
  image_path    The path to the image or directory with images to split.
  rows          How many rows to split the image into (horizontal split).
  cols          How many columns to split the image into (vertical split).

optional arguments:
  -h, --help                Show this help message and exit
  -s, --square              If the image should be resized into a square before splitting.
  -r, --reverse             Reverse the splitting process, i.e. merge multiple tiles of an image into one.
  --cleanup                 After splitting or merging, delete the original image/images.
  --load-large-images       Pass this flag for use with really large images.
  --output-dir <dir-name>   Set the output directory for image tiles (e.g. 'outp/images'). 
  --quiet                   Run without printing any messages.

Cat photo by Manja Vitolic on Unsplash

Bridge photo by Lance Asper on Unsplash

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

split_image-2.0.5.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

split_image-2.0.5-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file split_image-2.0.5.tar.gz.

File metadata

  • Download URL: split_image-2.0.5.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for split_image-2.0.5.tar.gz
Algorithm Hash digest
SHA256 61d7b3e6201ead43b5c2af141125b6c42506a7a0a49a2eb9a9aeb15a81b2f69d
MD5 24798cc6c141b7a51cb1f140921a6d81
BLAKE2b-256 098a145e78b7d8f80e9b249c5b02b4c7ef347c5cf18b60561fc58a387a7af609

See more details on using hashes here.

File details

Details for the file split_image-2.0.5-py3-none-any.whl.

File metadata

  • Download URL: split_image-2.0.5-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for split_image-2.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2853c743b622f137ab3c667b8488aad0e3939b27505b38d272fa0824d039532b
MD5 32e41a0fcdecbf0fa4f9177a61cbf2dc
BLAKE2b-256 849a42a5a12a37ccf89f7b3b7f44fcdd89f0d53d74f2ace62bae5e7fb452e9b3

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.0.5 This release

2 files

2.0.4

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.7.0

2 files

1.6.1

2 files

1.6.0

2 files

1.5.1

2 files

1.5.0

2 files

1.4.0

2 files

1.3.0

2 files

1.2.0

2 files

1.1.4

2 files

1.1.3

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page