Page 1 of 1

transparency not working

Posted: 2017-05-26T12:50:13-07:00
by rihad
composite -gravity Center -dissolve 20% overlay.png background.jpg output.jpg

This command works fine in 6.9.6, and produces a non-transparent overlay in 6.9.8.

Re: transparency not working

Posted: 2017-05-26T20:27:02-07:00
by fmw42
What is your exact version and platform. IM is at 6.9.8.6 currently. It would help if you posted your two images to some free hosting service and put the URLs here so we can test with your exact IM version and images.

Re: transparency not working

Posted: 2017-05-26T21:43:49-07:00
by rihad
The OS is FreeBSD 10.3
Working: ImageMagick-nox11-6.9.6.4_2,1 Image processing tools (legacy version)
Not working: ImageMagick-nox11-6.9.8.6,1 Image processing tools (legacy version)

Just about any kind of real-world photograph can be used as background, and "a text string" as a watermark in overlay.png, in which the white text is drawn on a transparent background, non-technically speaking :) It's neither black nor white, it's nothing. So the problem is - the white letters aren't dissolved (made sem-transparent) in the newer version, but are left as they were. I'll try to make up an example later.

Re: transparency not working

Posted: 2017-05-26T22:50:23-07:00
by rihad
Ok, here's what I've come up with.
First, I made a screenshot of this browser window and saved it as background.jpg.
Image
Then I used a free online tool to create a text string with a transparent background (http://www.picturetopeople.org/text_gen ... rator.html)
Image

Now for the good part. The barely visible overlaid text using the command in the first post & IM 6.9.6.
Image

And the failing IM 6.9.8:
Image

Re: transparency not working

Posted: 2017-05-26T23:09:40-07:00
by fmw42
Try using the more current IM 6 convert. It is more flexible than composite. This seems to work fine for me on IM 6.9.8.6 Q16 Mac OS X.

Code: Select all

convert background.jpg transparent_text_effect.png -gravity Center -set option:compose:args 100,20 -compose dissolve -composite tmp.png
or

Code: Select all

convert background.jpg transparent_text_effect.png -gravity Center -define compose:args=100,20 -compose dissolve -composite tmp.png
See
http://www.imagemagick.org/Usage/compose/
http://www.imagemagick.org/script/compose.php

Re: transparency not working

Posted: 2017-05-26T23:16:52-07:00
by fmw42
Note that values used in composite are typically reversed when used in convert.

Perhaps you really want 20,100. So if I have the results backwards, then use 20,100 in place of 100,20 (or perhaps you want 20,80).

Re: transparency not working

Posted: 2017-05-26T23:24:47-07:00
by fmw42
If you still find that results from 6.9.8.6 and 6.9.6.4 have swapped values, then let me know and I will download a version of 6.9.6.4 tomorrow and check it out. Perhaps that version had a transient bug?

Re: transparency not working

Posted: 2017-05-26T23:33:20-07:00
by rihad
Thank you, sir! This now works as expected in both versions.
convert bg.jpg overlay.png -gravity Center -define compose:args=20,100 -compose dissolve -composite out.jpg

Re: transparency not working

Posted: 2017-05-30T02:08:13-07:00
by rihad
FYI, the composite command in my original post produces the desired result in ImageMagick7-nox11-7.0.5.7
It looks like there's a bug in IM 6.9.8

Re: transparency not working

Posted: 2017-05-30T09:46:00-07:00
by fmw42
I get exactly the same results using 6.9.8-7 and 7.0.5-8

Code: Select all

convert bg.jpg overlay.png -gravity Center -define compose:args=20,100 -compose dissolve -composite out6.jpg

Code: Select all

magick bg.jpg overlay.png -gravity Center -define compose:args=20,100 -compose dissolve -composite out7.jpg

Re: transparency not working

Posted: 2017-05-30T10:53:18-07:00
by rihad
I was talking about the "composite" binary itself.
Works in 6.9.6.4 and 7.0.5.7
Fails in 6.9.8.6

Re: transparency not working

Posted: 2017-05-30T12:17:43-07:00
by fmw42
composite is an older syntax. You should always use the convert syntax these days since it is more flexible.