How to draw text antialiased on alpha channel only
Posted: 2015-07-21T06:16:56-07:00
We are upgrading from an old version of ImageMagick and finding that a command we have previously used now produces different results.
In ImageMagick 6.7.3-9 the following produces greyscale text on a transparent background, where the text is a solid colour (#AAAAAA) and is antialiased against the transparent background on the alpha channel only:
In ImageMagick 6.9.1-2 the same command produces greyscale text on a transparent background where the text is antialiased on the RGB channels (i.e. pixels are shades of grey). It appears that the pixel colour '#AAAAAA' gets scaled by the alpha value '#B8', so that the brightest pixel becomes '7A'.
ImageMagick 6.7.3-9:

ImageMagick 6.9.1-2:

How do we get ImageMagick 6.9.1-2 to produce the same results as the older version?
In ImageMagick 6.7.3-9 the following produces greyscale text on a transparent background, where the text is a solid colour (#AAAAAA) and is antialiased against the transparent background on the alpha channel only:
Code: Select all
convert -background transparent -resize 1024x768 -fill '#AAAAAAB8' -font Arial -pointsize 50 label:'Test Stamp' test.png
ImageMagick 6.7.3-9:

ImageMagick 6.9.1-2:

How do we get ImageMagick 6.9.1-2 to produce the same results as the older version?