将图像裁剪为具有比率的最大居中部分 [英] Crop image to biggest centred part with a ratio
问题描述
我想将图像剪裁到收音机,例如4:3。
I would like to crop image to a radio, 4:3 for instance.
但我想要最大的中心部分,例如:
But I would like the biggest centred part, for instance :
到
我没有'在 imagemagick文档中查找我的情况。
I didn't find my situation in the imagemagick documentation.
(Imgur尺寸非常小,但你应该明白了)
(Imgur sizes are quite inacurate but you should get the idea)
推荐答案
最后我为我写了一个小脚本:减少配额(它需要带有fastimage gem的红宝石: gem install fastimage
)
Finally I wrote a little script for me: reduce-ration (it requires ruby with the fastimage gem: gem install fastimage
)
在我的例子中: reduce-maxi 4x3 center shutup.png templerun.jpg
您可以使用它: reduce-maxi RATIO DIRECTION IMAGES ...
。有关更多详细信息,请参见要点。
You can use it like: reduce-maxi RATIO DIRECTION IMAGES...
. See the gist for more details.
我还写了一个脚本来获取图像的比例。请参阅要点。
I also wrote a script to get the ratio of the images. See the gist.
这篇关于将图像裁剪为具有比率的最大居中部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!