Composite 在 imagemagick7 与 imagemagick6 中不传输颜色
Composite not transferring color in imagemagick7 vs imagemagick6
我使用 imagemagick 构建我的应用商店图标。这个过程已经与 imagemagick6 一起工作多年。图标构建过程的最后一步是合成一个带有白色文本的蓝色正方形和一个白色圆角矩形。当我升级到 imagemagick7 时,最后一步生成了一个带有白色文本的圆形黑色图标。这是我的 shell 脚本中的代码:
# build a file with the two text lines centered with different, large point sizes for each
# then resize to the proper width
convert\
-gravity center\
-background transparent\
-fill white\
-font ArialB\
-pointsize ${TEXTSIZE} label:"${TEXT}"\
-pointsize ${TEXT2SIZE} label:"${TEXT2}"\
-append\
-resize $TEXTWIDTH\
tmpText.png
# build a background image with a radial gradient
convert\
-gravity center\
-size ${ICONSIZE}x${ICONSIZE} radial-gradient:"rgb(0,50,255)"-"rgb(0,0,127)"\
tmpBase.png
# combine the two
composite\
-gravity center\
tmpText.png tmpBase.png $FILENAME
在 imagemagick7 中,最后两个文件 tmpText.png 和 tmpBase.png 看起来正确,但输出不正确。我尝试了几种合成步骤的变体,但都无济于事。我终于降级回 imagemagick6,事情又开始工作了,但这不是一个长期的解决方案。有什么想法吗?
在 ImageMagick 7 中,将 convert 替换为 magick。也用 magick composite 替换 composite。
因此对于 IM 6:
convert\
-gravity center\
-background transparent\
-fill white\
-font ArialB\
-pointsize 24 label:"Testing1"\
-pointsize 24 label:"Testing2"\
-append\
-resize 200% \
tmpText.png
# build a background image with a radial gradient
convert\
-gravity center\
-size 500x500 radial-gradient:"rgb(0,50,255)"-"rgb(0,0,127)"\
tmpBase.png
# combine the two
composite\
-gravity center\
tmpText.png tmpBase.png fred_test6.png
我得到:
对于 IM 7
magick\
-gravity center\
-background transparent\
-fill white\
-font ArialB\
-pointsize 24 label:"Testing1"\
-pointsize 24 label:"Testing2"\
-append\
-resize 200% \
tmpText.png
# build a background image with a radial gradient
magick\
-gravity center\
-size 500x500 radial-gradient:"rgb(0,50,255)"-"rgb(0,0,127)"\
tmpBase.png
# combine the two
magick composite\
-gravity center\
tmpText.png tmpBase.png fred_test7.png
我得到:
我使用 imagemagick 构建我的应用商店图标。这个过程已经与 imagemagick6 一起工作多年。图标构建过程的最后一步是合成一个带有白色文本的蓝色正方形和一个白色圆角矩形。当我升级到 imagemagick7 时,最后一步生成了一个带有白色文本的圆形黑色图标。这是我的 shell 脚本中的代码:
# build a file with the two text lines centered with different, large point sizes for each
# then resize to the proper width
convert\
-gravity center\
-background transparent\
-fill white\
-font ArialB\
-pointsize ${TEXTSIZE} label:"${TEXT}"\
-pointsize ${TEXT2SIZE} label:"${TEXT2}"\
-append\
-resize $TEXTWIDTH\
tmpText.png
# build a background image with a radial gradient
convert\
-gravity center\
-size ${ICONSIZE}x${ICONSIZE} radial-gradient:"rgb(0,50,255)"-"rgb(0,0,127)"\
tmpBase.png
# combine the two
composite\
-gravity center\
tmpText.png tmpBase.png $FILENAME
在 imagemagick7 中,最后两个文件 tmpText.png 和 tmpBase.png 看起来正确,但输出不正确。我尝试了几种合成步骤的变体,但都无济于事。我终于降级回 imagemagick6,事情又开始工作了,但这不是一个长期的解决方案。有什么想法吗?
在 ImageMagick 7 中,将 convert 替换为 magick。也用 magick composite 替换 composite。
因此对于 IM 6:
convert\
-gravity center\
-background transparent\
-fill white\
-font ArialB\
-pointsize 24 label:"Testing1"\
-pointsize 24 label:"Testing2"\
-append\
-resize 200% \
tmpText.png
# build a background image with a radial gradient
convert\
-gravity center\
-size 500x500 radial-gradient:"rgb(0,50,255)"-"rgb(0,0,127)"\
tmpBase.png
# combine the two
composite\
-gravity center\
tmpText.png tmpBase.png fred_test6.png
我得到:
对于 IM 7
magick\
-gravity center\
-background transparent\
-fill white\
-font ArialB\
-pointsize 24 label:"Testing1"\
-pointsize 24 label:"Testing2"\
-append\
-resize 200% \
tmpText.png
# build a background image with a radial gradient
magick\
-gravity center\
-size 500x500 radial-gradient:"rgb(0,50,255)"-"rgb(0,0,127)"\
tmpBase.png
# combine the two
magick composite\
-gravity center\
tmpText.png tmpBase.png fred_test7.png
我得到: