使用imagemagick如何将图像切成几个单独的图像? [英] Using imagemagick how can i slice up an image into several separate images?

查看:104
本文介绍了使用imagemagick如何将图像切成几个单独的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请考虑以下示例:

源图像由6个区域组成,这些区域需要切成6个单独的图像.

The source image consists of 6 areas that need to be sliced up into 6 separate images.

如何使用imagemagick获得所需的输出.我试图了解imagemagick 示例中提出的可能解决方案,但未能将其转移到我的具体问题.

How can I get the desired output using imagemagick. I tried to understand a possible solution presented in the imagemagick examples, but failed to transfer it to my specific problem.

最好以单线方式解决此问题的方法是什么? 由于我要切片的所有区域都具有相同的大小,但是它们的偏移量仅不同,是否有办法以某种方式传递预设的区域大小,然后为每个区域简单地添加xy-offset?

What would be a way of solving this problem preferably in a one-liner? Since all the areas which i want to slice have the same size, but only differ in their offset, is there a way to somehow pass a preset area size, and then simply add the xy-offset for each area?

推荐答案

如果每个区域周围都有相同的填充量,则可以使用

If each area has the same amount of padding around it, you can use the @ operator.

这会将图像切成6个部分,每行2个,每个部分不包括40像素的水平填充和20像素的垂直填充:

This cuts an image into 6 sections, 2 per row, with 40 pixels of horizontal padding and 20 pixels of vertical padding excluded from each section:

convert image.png -crop 2x3-40-20@ +repage +adjoin tile-%d.jpg

这篇关于使用imagemagick如何将图像切成几个单独的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆