以下是给我一个预期大小的空白图像:
magick convert a.png b.png -compose difference -composite out.png
但是,我可以生成正确的 jpg 输出:
magick convert a.png b.png -compose difference -composite out.jpg
然后我尝试将其转换为 png 并且效果很好:
magick convert out.jpg out.png
为什么第一个命令给我一个空白图像,我该如何解决这个问题?
Libpng version 1.6.37.
Version: ImageMagick 7.0.11-8 Q16 x86_64 2021-04-17 https://imagemagick.org
Copyright: (C) 1999-2021 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(4.5)
Delegates (built-in): bzlib freetype gslib heic jng jp2 jpeg lcms lqr ltdl lzma openexr png ps tiff webp xml zlib
更新:
Bmp 也是空白:
magick convert a.png b.png -compose difference -composite out.bmp
这也适用于 jpg 但不适用于 png:
composite -compose difference a.png b.png out.png
这是我在运行verbose时看到的:
a.png PNG 500x700 500x700+0+0 8-bit sRGB 125771B 0.030u 0:00.016
b.png PNG 500x700 500x700+0+0 8-bit sRGB 90207B 0.020u 0:00.012
a.png=>b.png PNG 500x700 500x700+0+0 8-bit sRGB 90207B 0.450u 0:00.084
这是有效的,并提供了我所需的输出:
composite -verbose -compose minus a.png b.png out.png