srkleiman
srkleiman

Reputation: 727

Composite not transferring color in imagemagick7 vs imagemagick6

I build my app store icons using imagemagick. The process has been working for years with imagemagick6. The final step in the icon building proceed is to composite a blue square with white text and a rounded white rectangle. When I upgraded to imagemagick7, the final step produced a rounded black icon with white text. Here's the code in my shell script:

# 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

In imagemagick7 the final two files tmpText.png and tmpBase.png look correct, but the output does not. I tried several variations of the compositing step to no avail. I finally downgraded back to imagemagick6, and things started working again, but that's not a long-term solution. Any ideas?

Upvotes: 0

Views: 165

Answers (1)

fmw42
fmw42

Reputation: 53111

With ImageMagick 7, replace convert with magick. Also replace composite with magick composite.

So for 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

I get:

enter image description here

And for 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

I get:

enter image description here

Upvotes: 1

Related Questions