ImageMagick convert - text over alpha background

I am trying to post a copyright notice in a large batch of PNG images. I would like to place a message in the lower right corner in black text on a translucent white background. Here is my Windows command line script that traverses the images and starts the ImageMagick converter and composite pipeline:

for %%f in (*.png) do (
  convert -background "#FFFFFF80" -font verdana -fill black ^
           label:" (c) 2015 My Company "  miff:-            ^
  | composite -compress zip -gravity SouthEast              ^
              -geometry +0+0 - "%%f" "credited\%%f.png" )

      

A white background with 50% opacity (0x80) works well, but when the label text is rendered into an image, there is a terrible gray background on the background of the characters. Here's an example by simply running the original convert to PNG.

enter image description here

Is this a bug or am I missing something important in managing the IM alpha channels?

+3


source to share


1 answer


Executing these commands on OSX with version 6.9.0-0 Q16 x86_64 2014-12-06

:

convert -background '#ffffff80' -font verdana \
        -size 360 -fill black label:"Hello World" hw1.png

convert -background '#00000080' -font verdana \
        -size 360 -fill black label:"Hello World" hw2.png

convert -background '#ff000080' -font verdana \
        -size 360 -fill black label:"Hello World" hw3.png

composite hw1.png -geometry +100+10 hw2.png comp12.png
composite hw1.png -geometry +100+10 hw3.png comp13.png

      

creates the following images:

"Hello World" -image 1



"Hello World" -image 2

"Hello World" -image 3

hw1 + hw2 composite

hw2 + hw3 composite

+2


source







All Articles