Mobile app version of vmapp.org
Login or Join
Welton168

: Slice an image into pieces and generate images that contain all the prior parts Say I have an image of width 1000. I need to slice the image into 100 slices ,which will generate 100 images.

@Welton168

Posted in: #AdobePhotoshop #Crop #Slices

Say I have an image of width 1000. I need to slice the image into 100 slices ,which will generate 100 images. Each one of the 100 images must be of length 10 * (slice number), so that it will contain all the previous parts as well.

So slice 1 will contain the first 1/100 of the initial image, slice 2 the 2/100 etc.

Is there a way to do this on Photoshop,using an online tool or any other program/library?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Welton168

1 Comments

Sorted by latest first Latest Oldest Best

 

@BetL875

This may be a case for a batch solution.

By using the ImageMagick crop by percent function we can crop an image any given percentage from 1% to 100%.

Images below were cropped with the following command:

convert <input> -crop <x>%x0+0+0 <out>


Where <input> is the source image name, <x> is the precentage, and <out> it the output filename.


Cropped with <x> = 1, 10, 20, 30, 40, 50

Cropped with <x> = 60, 70

Cropped with <x> = 80

Cropped with <x> = 90

Cropped with <x> = 100 (this was the source image)

Of course this need not be done manually but can easily be included in a script.

On a POSIX OS the following Bash script will produce 100 stacked slices (like above) starting at 1% to 100% and write these as out-<x>.jpg in the same directory from an image given as a command line parameter.

#! /bin/bash

# filename

for ((i=100; i>=1; i--)); do
echo "$i"
convert "" -crop $i%x0+0+0 "out-$i.jpg"
done

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme