简体   繁体   English

FFmpeg瓷砖裁剪

[英]FFmpeg tile cropping

This image is splitted to 12 equal pieces. 该图像被分成12个相等的部分。 Is there any way to do such a work with ffmpeg? 有什么办法可以用ffmpeg做这样的工作吗?

该图片已上传至Instagram

Use 采用

ffmpeg -loop 1 -i image.png -vf "crop=iw/3:ih/4:mod(n,3)*iw/3:trunc(n/3)*ih/4" -vframes 12 out%d.png

For full coverage of image, the image width has to be divisible by 3, and height by 4. 为了完全覆盖图像,图像宽度必须被3整除,高度必须被4整除。


For square output, set crop height to crop width. 对于正方形输出,将作物高度设置为作物宽度。 The vertical crop leaves some space at top and bottom. 垂直作物在顶部和底部留有一些空间。

ffmpeg -loop 1 -i image.png -vf "crop=iw/3:iw/3:mod(n,3)*iw/3:trunc(n/3)*iw/3+(ih-iw)/2" -vframes 12 out%d.png

(This method requires that ih/4 > iw/3 for desired output) (此方法要求ih / 4> iw / 3以获得所需的输出)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM