/images_slicer

Images slicer

Primary LanguagePythonMIT LicenseMIT

Build Status Coverage Status

images_slicer

Multi-thread Python app for slicing images.

Start point - [0, 0] - upper left corner of the image.

Tags

python, image, processing, slice, slicing, multithread

Usage

$python images_slicer.py PATH_TO_FOLDER WIDTH HEIGHT -ADD -S RESULTS_FOLDER
  • PATH_TO_FOLDER - absolute path to the folder with images that you want to slice
  • WIDTH - width of the slice
  • HEIGHT - height of the slice
  • -ADD - (optional) add extra space at the last slice. If not set, extra space will be omitted (see examples).
  • -RESULTS_FOLDER - (optional) absolute path where slices should be saved. If not set, slice images will be saved at folder PATH_TO_FOLDER.

Examples

Create slices with size 100x90 for all images in images_folder:

$ python images_slicer.py /home/my_user_name/images_folder 100 90

Create slices with size 300x20 for all images in images_folder. If the size of the last slice is less than required, than it will be appended to previous slice. So for image of size 400x50 will be created 2 slices - 400x20 and 400x30:

$ python images_slicer.py /home/my_user_name/images_folder 300 20 -add

Create slices with size 100x90 for all images in images and save them to /some/other-folder:

$ python images_slicer.py C:\\images 100 90 -s /some/other-folder

Show help:

$ python images_slicer.py -h

Requirements

Python >= 2.6

Pillow (PIL) library

$pip install Pillow