Imagemagick 如何在不丢失颜色的情况下在黑白图像上合成彩色 png?
Imagemagick how to compose colored png on black and white image without losing the colors?
我正在尝试使用 Imagemagick 在灰度图像上合成带红点的彩色 png,但我得到的结果是带白点的黑白图像。
我正在使用这个命令行:
composite -tile -compose Hardlight red-dots.png image.jpg result.jpg
这是结果:
在 Photoshop 中,我可以通过将 image.jpg 模式更改为 RVB 颜色来获得我想要的效果,我得到了这个:
以下是我使用的示例:
这是在 ImageMagick 中执行此操作的一种方法。
输入:
平铺:
Line 1: convert command
Line 2: read the tile, save to MPR, then delete the image (keeping the mpr)
Line 3: read the face image and save to MPR, but keep the image
Line 4: use the image and draw the tile over it to fill the dots out to the size of the image
Line 5: bring the mpr face image back again
Line 6: swap it with the filled out dots image
Line 7: apply headlight composition
Line 8: save the result
convert \
red_dots.png -write mpr:dots +delete \
man_face.jpg -write mpr:face \
-fill mpr:dots -draw 'color 0,0 reset' \
mpr:face \
+swap \
-compose hardlight -composite \
result.png
结果:
另一种方法如下:
Line 1: convert command
Line 2: read the face image
Line 3: set the distort viewport to the size of the image
Line 4: read the dots image
Line 5: do a distort with no change of the image orientation or size to tile it out to the size of the face image
Line 6: do hard light composite
Line 7: save the result
convert \
man_face.jpg \
-set option:distort:viewport '%g' \
\( red_dots.png \
-virtual-pixel tile -filter point -distort SRT 0 \) \
-compose hardlight -composite \
result2.png
我正在尝试使用 Imagemagick 在灰度图像上合成带红点的彩色 png,但我得到的结果是带白点的黑白图像。
我正在使用这个命令行:
composite -tile -compose Hardlight red-dots.png image.jpg result.jpg
这是结果:
在 Photoshop 中,我可以通过将 image.jpg 模式更改为 RVB 颜色来获得我想要的效果,我得到了这个:
以下是我使用的示例:
这是在 ImageMagick 中执行此操作的一种方法。
输入:
平铺:
Line 1: convert command
Line 2: read the tile, save to MPR, then delete the image (keeping the mpr)
Line 3: read the face image and save to MPR, but keep the image
Line 4: use the image and draw the tile over it to fill the dots out to the size of the image
Line 5: bring the mpr face image back again
Line 6: swap it with the filled out dots image
Line 7: apply headlight composition
Line 8: save the result
convert \
red_dots.png -write mpr:dots +delete \
man_face.jpg -write mpr:face \
-fill mpr:dots -draw 'color 0,0 reset' \
mpr:face \
+swap \
-compose hardlight -composite \
result.png
结果:
另一种方法如下:
Line 1: convert command
Line 2: read the face image
Line 3: set the distort viewport to the size of the image
Line 4: read the dots image
Line 5: do a distort with no change of the image orientation or size to tile it out to the size of the face image
Line 6: do hard light composite
Line 7: save the result
convert \
man_face.jpg \
-set option:distort:viewport '%g' \
\( red_dots.png \
-virtual-pixel tile -filter point -distort SRT 0 \) \
-compose hardlight -composite \
result2.png