Slicing image

i would love to slice images (transform one image to multiple images in a raster; alike

or, as a fallback, exec a bash script eg. within a shortcode to call imagemagick and do the trick.

does anyone have an idea how i can acomplish this ?

I never heard of the ability to run bash scripts from a shortcode. That would be great :slight_smile:

Other than that, the way I would approach this is to define a grid for x and y and loop through these numbers to cut the original image into little pieces.

Sample (not code, just the logic):
image is 200px by 200px
x = [ 0, 50, 100, 150 ]
y = [ 0, 50, 100, 150 ]
image 1 = x1 to x2 and y1 to y2
image 2 = x2 to x3 and y1 to y2

image 16 = x4 to end and y4 to end
then you have 16 parts that you can use.

this looks more complicated than it is I think.

is there a way to do those calculation and cropping operations in a shortcode/layout template ?