ImageMagick和几何问题 - 使用>调整大小 [英] ImageMagick and Geometry Issue - resizing with >
问题描述
使用最新版本的imageMagick for windows(今日下载)
small_image.jpg = 16x16
large_image.jpg = 800x600
using the latest version of imageMagick for windows (downloaded today)
small_image.jpg = 16x16
large_image.jpg = 800x600
转换small_image.jpg -gravity中心-resize'208x120>' - 背景white -extent 208x120 s_icon.gif
convert small_image.jpg -gravity Center -resize '208x120>' -background white -extent 208x120 s_icon.gif
产生:转换:无效几何`` 208x120'@ geometry.c / ParseRegionGeometry / 1322但它仍然会生成一个208x120的图像,其中16x16的小图像完美地居中于新图像中。完美。
produces: "convert: invalid geometry `'208x120' @ geometry.c/ParseRegionGeometry/1322" yet it still produces a 208x120 image with the tiny 16x16 image perfectly centered within the new image. Perfect.
然而,如果我尝试使用较大的图像,它会给我同样的错误,但它实际上似乎是裁剪而不是缩小为208x120>暗示。
However, if I try it with the larger image, it gives me the same error but it actually seems to crop rather than scale down as the "208x120>" implies.
这是什么错误,如何修复它以及为什么这个命令行不能用于放大图像?
What is that error, how do I fix it and why doesn't this command line work for larger images?
文档不是很好:(
推荐答案
我遇到了同样的问题。显然这是因为你在使用单引号而不是双(正常)引号。你的字符串应该是这样的:
I had the same issue. Apparently it's because you are using single quotes instead of double (normal) quotes. Your string should be like this:
convert small_image.jpg -gravity Center -resize "208x120>" -background white -extent 208x120 s_icon.gif
不知道是否允许这样做在* nix上,因为文档没有提到它......
Don't know if this is allowed on *nix, since the documentation doesn't mention it...
这篇关于ImageMagick和几何问题 - 使用>调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!