4
votes

I'm trying to place a copyright message on a large batch of PNG images. I'd like to place the message in the bottom-right corner in black text on a semi-transparent white background. Here's my Windows command line script which loops through the images and runs a ImageMagick convert & 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" )

The white background with 50% (0x80) opacity is working well, but when the label text renders into the image, there's a horrible grey in the background of the characters. Here is an example by just running the initial convert into a PNG.

enter image description here

Is this a bug or am I missing something important in IM alpha channel management?

1
Which version does convert -version report for you?Kurt Pfeifle
I do not see anything being wrong with your approach. (I took the liberty to re-format your command so it spans multiple lines to avoid horizontal scrolling. Hopefully I remembered correctly the cmd.exe syntax required for this... Otherwise just revert and/or correct it!)Kurt Pfeifle
Try adding the -matte operator before label:. I half remember a previous thread about fonts and matte channel on older versions of IM.emcconville
I'm on 6.9.1-2 Q16 on x86 (2015-04-14), freshly downloaded today.Warren Vick

1 Answers

2
votes

Running 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

produces the following images:

"Hello World"-image 1

"Hello World"-image 2

"Hello World"-image 3

hw1 + hw2 composite

hw2 + hw3 composite