缩放缩放和向上时,转换不节省大小
为了使模糊更快地施加模糊,我首先将图像缩放为缩小图像,然后将其扩展为缩小:
convert - -scale 10% -blur 0x2.5 -resize 1000% RGB:-
这大部分时间都可以使用,但有时输出分辨率与原始输入略有不同。有没有办法迫使管道具有尺寸的尺寸?
In order to make applying blur faster I'm first scaling my image down and then scale it back up:
convert - -scale 10% -blur 0x2.5 -resize 1000% RGB:-
This works most of the time but sometimes the output resolution is slightly different from the original input. Is there a way to force the pipeline to be size-preserving?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该能够通过%G :
如果您使用的是 Windows ,则可能需要
“%g!”
以双引号而不是单引号。如果使用V7 ImageMagick ,请用
magick
替换convert
。我认为您会遇到错误,因为如果您服用72个像素的10%(例如),您将获得大量像素,即7个像素,然后当您缩放10倍10倍时,您将获得70而不是您的最初72。
You should be able to access the original geometry of the image via %G, so you can do:
If you are using Windows, you probably want
"%G!"
in double rather than single quotes.If you are using v7 ImageMagick, replace
convert
withmagick
.I think you are getting errors because if you take 10% of 72 pixels (say), you will get a whole number of pixels, i.e. 7 pixels and then when you scale back up by a factor of 10 you'll get 70 rather than your initial 72.
如果使用ImageMagick 7,则可以执行以下操作:
这存储输入宽度和高度。然后,使用存储的值将这些维度的1/10缩放,然后进行模糊,然后将其精确地调整回原点输入大小。注意!这迫使调整大小到确切的尺寸。
或更简单,而无需存储输入宽度和高度:
If you are using Imagemagick 7, you can do the following:
This stores the input width and height. Then uses the stored values to scale by 1/10 of those dimensions, then does the blur, then resizes exactly back to the origin input size. Note the ! that forces the resize to the exact dimensions.
or simpler without storing the input width and height: