Split square images into many images with Python and image_slicer

In the last post we joined togheter more images, now we are going to do the opposite with one module and one line of code. We will use only square images, though.

import image_slicer
image_slicer.slice('image.png', 25)

Another script

Whith this one you will be asked to choose an image to split and then you will enter the number of rows (equal to the column).

import image_slicer
from tkinter import filedialog

fname = filedialog.askopenfilename(initialdir = ".",title = "Select file",filetypes = (("png","*.png"),("all files","*.*")))
print("Input the number of row that must be equal to the number of column")
rows = int(input("how many rows? > "))

image_slicer.slice(fname, rows)
print("done")

 

Utilities

Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.