Transparency working differently in 6.5 from 6.3 and 6.4

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
rzuris

Transparency working differently in 6.5 from 6.3 and 6.4

Post by rzuris »

Here is a command that we've been using to create a transparent watermark that later gets composited onto images:

convert -size 1000x1000 -font Times-BoldItalic -pointsize 30 -gravity center xc:transparent -draw "fill black text 1,1 'H20 MARK' fill white text -1,-1 'H20 MARK' fill transparent text 0,0 'H20 MARK'" png:test.png

This results in a black background in IM 6.5 instead of transparent in IM 6.4 and below.

I had to change it to specify transparency by using an RGBA color value:

convert -size 1000x1000 -font Times-BoldItalic -pointsize 30 -gravity center xc:"rgba(255,63,63,0)" -draw "fill black text 1,1 'H20 MARK' fill white text -1,-1 'H20 MARK' fill transparent text 0,0 'H20 MARK'" png:test.png

That results in a transparent background in IM 6.5.2, 6.4.1, and 6.3.5. But if the RGBA value either equals or is close to the text color(s), the background becomes that color instead of transparent:

convert -size 1000x1000 -font Times-BoldItalic -pointsize 30 -gravity center xc:"rgba(250,250,250,0)" -draw "fill black text 1,1 'H20 MARK' fill white text -1,-1 'H20 MARK' fill transparent text 0,0 'H20 MARK'" png:test.png

results in a white background

convert -size 1000x1000 -font Times-BoldItalic -pointsize 30 -gravity center xc:"rgba(25,25,25,0)" -draw "fill black text 1,1 'H20 MARK' fill white text -1,-1 'H20 MARK' fill transparent text 0,0 'H20 MARK'" png:test.png

results in a black background

Is this a bug?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Transparency working differently in 6.5 from 6.3 and 6.4

Post by fmw42 »

convert -size 1000x1000 -font Times-BoldItalic -pointsize 30 -gravity center xc:transparent -draw "fill black text 1,1 'H20 MARK' fill white text -1,-1 'H20 MARK' fill transparent text 0,0 'H20 MARK'" png:test.png
This works fine for me in IM 6.5.4.0 Q16 Mac OSX Tiger. Get a transparent background with white text and black shading.
rzuris

Re: Transparency working differently in 6.5 from 6.3 and 6.4

Post by rzuris »

This occurs for me on RedHat Enterprise 5 with ImageMagick 6.5.2-3 Q16.

I'll try a later version when I get a chance.
Post Reply