ImageMagick: Crop image into separate images of same area but at an interval along axis

cropffmpegimage editingimagemagick

With either imagemagick or ffmpeg is there a way to crop a single image into separate images (put into an output folder) which are of same area (say 2000×500) but at say 20 pixel intervals down the y-axis? I will post an image explanation of what I am trying to achieve:


Best Answer

Let's say your input image is 1000x3000 and crop size is 1000x500. So we start from y=0 and end at y=2500. With a step of 10 px, we need 250 frames.

With ffmpeg,

ffmpeg -loop 1 -i input -vf crop=w=1000:h=500:x=0:y=n*10 -vframes 250 out%d.png

n is the frame index, starting from 0.

Related Question