如何使用imagemagick对照片应用40%混合效果?

发布于 2025-01-10 13:21:37 字数 505 浏览 4 评论 0 原文

对于使用翻译器时英语的尴尬,我深表歉意。

我想将照片 2 应用于照片 1,并具有 40% 的叠加效果。 我成功地覆盖了它,但它是100%的。 有没有办法应用 40% 的混合效果?

图片

下面是我使用的代码。

magick Convert -composite -compose overlay 1.png 2.png out.png

这里是一个 psd 示例文件。

https://drive.google.com/file/d/1hE8LHCO5pWOiWvguce463ZVMw9LdV0pv/查看?usp=共享

I apologize for the awkwardness of English by using the translator.

I'd like to apply photo 2 to photo 1 with a 40% overlay effect.
I succeeded in overlaying it, but it's 100%.
Is there a way to apply 40% of the blending effect?

image

Below is the code I used.

magick convert -composite -compose overlay 1.png 2.png out.png

here is a psd example file.

https://drive.google.com/file/d/1hE8LHCO5pWOiWvguce463ZVMw9LdV0pv/view?usp=sharing

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

给我一枪 2025-01-17 13:21:37

好的。我能够访问您的 PSD 文件并将其导出为 PNG,并且可以看到它在透明度值设置和混合模式方面使用的过程。

输入图片这里的描述

我把基础镜像分离出来了,如下。

输入图片这里的描述

下面是 Imagemagick 7 中的 3 个变体,它们与 Photoshop 所创建的内容很接近:

magick cat.png -alpha off \( +clone -fill yellow -colorize 40% \) -compose overlay -composite cat_yellow1.png

在此处输入图像描述

magick cat.png -alpha off \( +clone -fill yellow -colorize 100% -channel a -evaluate set 40% +channel \) \( -clone 0 \) -compose overlay -composite cat_yellow2.png

在此处输入图像描述

magick cat.png -alpha off \( +clone -fill yellow -colorize 100% \) \( -clone 0 \) -define compose:args=40,60 -compose overlay -composite cat_yellow3.png

在此处输入图像描述

OK. I was able to access your PSD file and exported it as a PNG and can see what process it uses in terms of the transparency values set and blending mode.

enter image description here

I separated out the base image, which is as follows.

enter image description here

So here are 3 variations in Imagemagick 7 that are close to what Photoshop is creating:

magick cat.png -alpha off \( +clone -fill yellow -colorize 40% \) -compose overlay -composite cat_yellow1.png

enter image description here

magick cat.png -alpha off \( +clone -fill yellow -colorize 100% -channel a -evaluate set 40% +channel \) \( -clone 0 \) -compose overlay -composite cat_yellow2.png

enter image description here

magick cat.png -alpha off \( +clone -fill yellow -colorize 100% \) \( -clone 0 \) -define compose:args=40,60 -compose overlay -composite cat_yellow3.png

enter image description here

奢华的一滴泪 2025-01-17 13:21:37

您可以像这样指定百分比混合:

magick 1.png 2.png -define compose:args=40,60 -compose overlay -composite result.png

避免 magick Convert ... 它会导致较旧的 v6 行为,这是很少需要的。另外,尝试在应用运算符之前指定输入图像。

You can specify percentage mix like this:

magick 1.png 2.png -define compose:args=40,60 -compose overlay -composite result.png

Avoid magick convert ... it leads to older, v6 behaviour which is rarely desirable. Also, try to specify input images before operators applied to them.

痴者 2025-01-17 13:21:37

马克是正确的。使用-compose 混合。您将在 Imagemagick 7 上执行以下操作

magick 1.png 2.png -define compose:args=40,60 -compose blend -composite result.png

如果使用 Imagemagick 6,则将 magick 更改为 convert

Mark is correct. Use -compose blend. You would do the following on Imagemagick 7

magick 1.png 2.png -define compose:args=40,60 -compose blend -composite result.png

If using Imagemagick 6, then change magick to convert.

时光无声 2025-01-17 13:21:37

使用 ImageMagick 将颜色应用于图像的方法有很多种。如果某些特定方法没有给出您想要的结果,也许可以探索一些其他选项。以下是一些示例命令以及我们可能得到的结果类型...

输入图像...

在此处输入图像描述 在此处输入图像描述


使用“叠加”方法的简单合成...

magick 1.png 2.png -compose overlay -composite test_overlay.png

在此处输入图像描述


一个40/60 复合与“混合”方法...

magick 1.png 2.png -compose blend -define compose:args=40,60 -composite test_blend.png

在此处输入图像描述


使用“colorize”方法应用颜色...

magick 1.png 2.png -compose colorize -composite test_colorize.png

在此处输入图像描述


使用“乘法”合成方法进行合成...

magick 1.png 2.png -compose multiply -composite test_multiply.png

在此处输入图像描述


使用 -tint 为图像添加颜色...

magick 1.png -fill #F5FF00 -tint 100 test_tint.png

在此处输入图像描述


There are many ways to apply color to an image using ImageMagick. If some particular method isn't giving the results you're looking for, maybe explore some other options. Here are some example commands and the kinds of results we might get...

The input images...

enter image description here enter image description here


A simple composite with the "overlay" method...

magick 1.png 2.png -compose overlay -composite test_overlay.png

enter image description here


A 40/60 composite with the "blend" method...

magick 1.png 2.png -compose blend -define compose:args=40,60 -composite test_blend.png

enter image description here


Using the "colorize" method to apply the color...

magick 1.png 2.png -compose colorize -composite test_colorize.png

enter image description here


Composite with the "multiply" compose method...

magick 1.png 2.png -compose multiply -composite test_multiply.png

enter image description here


Add color to the image using -tint...

magick 1.png -fill #F5FF00 -tint 100 test_tint.png

enter image description here


~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文