Imagemagick:使用从GIMP获取的白色填充尺寸

huangapple go评论57阅读模式
英文:

Imagemagick: fill white color dimension taken from GIMP

问题

Here's the translated part of your text:

以下是要翻译的内容:

假设有以下图片。我想要用白色填充带有字母 ry 的部分(ry 只是一个示例问题)。可以使用以下命令来完成:

mogrify -fill white -draw "rectangle <坐标, 大小>" *.jpg

我想知道如何将在 GIMP 中选择的 ry 部分的图像“转换”为 imagemagick 可以理解的内容?换句话说,给定在 GIMP 中制作的选择,我应该在 <坐标, 大小> 中使用什么值?

根据您的请求,我展示了 GIMP 坐标的样子:

在使用 GIMP 坐标时,我使用以下命令来裁剪图像:mogrify -crop 0x0+4248+6336 *.jpg

其中:

  • 0 - 左边的位置
  • 0 - 右边的位置
  • 4248 - 左边的大小
  • 6336 - 右边的大小

也许这对您有所帮助。

英文:

Say there is a following image. I'd like to fill the part with letters ry with white color (ry is an example for a question). It can be done by the following command:

mogrify -fill white -draw &quot;rectangle &lt;coordinates, size&gt;&quot; *.jpg

I'd like to know how do I "convert" selection of ry part of the image from GIMP to be understood by imagemagick? In other words, given selection made in GIMP, what values do I use instead of &lt;coordinates, size&gt;?

Imagemagick:使用从GIMP获取的白色填充尺寸

As per request, I show how GIMP coordinates look:

Imagemagick:使用从GIMP获取的白色填充尺寸

On a side node, I use the following command to crop image using mogrify when using coordinates from GIMP mogrify -crop 0x0+4248+6336 *.jpg

where 0 -> position from left, 0 -> position from right
4248 -> size from left, 6336 -> size from right
Perhaps this helps.

答案1

得分: 0

If I assume your coordinates are top-left corner, width and height, then there are two ways to fill white in Imagemagick. The first is to overlay a white image. The second is to draw a white rectangle.

Overlay White Image:

convert ry.jpg -size 389x260 xc:white -geometry +1179+486 -compose over -composite result.jpg
  • -size specifies the size of the white image
  • -geometry specifies the top left corner of the white image in the background image

Draw White Rectangle:

convert ry.jpg -fill white -draw "rectangle 1179,486 1568,746" -alpha off result2.jpg

The top-left corner and the bottom-right corner coordinates are used

英文:

If I assume your coordinates are top-left corner, width and height, then there are two ways to fill white in Imagemagick. The first is to overlay a white image. The second is to draw a white rectangle.

Overlay White Image:

convert ry.jpg -size 389x260 xc:white -geometry +1179+486 -compose over -composite result.jpg

-size specifies the size of the white image
-geometry specifies the top left corner of the white image in the background image

Imagemagick:使用从GIMP获取的白色填充尺寸

Draw White Rectangle:

convert ry.jpg -fill white -draw &quot;rectangle 1179,486 1568,746&quot; -alpha off result2.jpg

The top-left corner and the bottom-right corner coordinates are used

Imagemagick:使用从GIMP获取的白色填充尺寸

huangapple
  • 本文由 发表于 2023年6月12日 07:08:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/76452848.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定