Page 1 of 1
Overlay transparanty bug
Posted: 2012-10-24T04:32:28-07:00
by Marcel71
Hi IM Team,
I use this image:
http://imgur.com/qnN2x,x9mVa
When i do the following:
Code: Select all
convert -size 600x500 xc:"#FF0000ff" -alpha set ( hearts.png -resize 166x165! -channel Alpha -evaluate Divide 2 +channel ) -geometry +223+105 -compose Over -composite final_template.png
Result looks good.
However when i do:
Code: Select all
C:\Temp\badge>convert -size 600x500 xc:"#FF0000ff" -alpha set ( hearts.png -resize 166x165! -channel Alpha -eva
luate set 50% +channel ) -geometry +223+105 -compose Over -composite final_template.png
Result is wrong, The overaly image turned totally black.
I need the second code, because the transparency is set between 1 and 100%. (and it is part from a much larger convert.
Is this a bug or am i doing something wrong?
Regards,
Marcel
Re: Overlay transparanty bug
Posted: 2012-10-24T09:23:03-07:00
by fmw42
On windows % needs to be escaped to %%
set 50% ===> se 50%%
Re: Overlay transparanty bug
Posted: 2012-10-24T12:50:29-07:00
by Marcel71
Result is still the same:
http://imgur.com/9oT3g
If i change the value 50% to another value, i can see the overlay becoming more or less transparent, however, still a 'box' instead of the image.
Re: Overlay transparanty bug
Posted: 2012-10-24T13:25:42-07:00
by fmw42
Marcel71 wrote:Result is still the same:
http://imgur.com/9oT3g
If i change the value 50% to another value, i can see the overlay becoming more or less transparent, however, still a 'box' instead of the image.
I do not see where you have posted your hearts.png image. The two original images you posted are 1) all black image and 2) a smaller all red image.
Others cannot test, if we do not have your exact image, which is hearts.png from your command.
You command seems to want to create a large red image and then overlay a half transparent hearts.png image. Is that correct?
What are you expecting? You result appears to be a red background with a smaller partially transparent red square placed on it. What are you expecting differently?
Re: Overlay transparanty bug
Posted: 2012-10-26T20:27:47-07:00
by snibgo
Windows needs % to be doubled only in command files, not in direct commands at the command window.
The original image is entirely black. The pretty picture is made from some of the pixels being transparent, and some opaque. The second command make all the pixels the same transparency, so it no longer contains a pretty picture.
"-evaluate multiply 0.5" might give you the effect you want.
Re: Overlay transparanty bug
Posted: 2012-10-28T00:53:58-07:00
by Marcel71
Hi,
I uploaded the images somewhere else.
The hearts image:
http://gifhoster.com/hearts.png
When converting with -evaluate set 70% the result should be:
http://gifhoster.com/good_result.png
Code: Select all
C:\Temp\badge>convert -size 600x500 xc:"#FF0000ff" -alpha set ( hearts.png -resize 166x165! -channel Alpha -evaluate set 70% +channel ) -geometry +233+105 -compose Over -composite final_template.png
But the result is:
http://gifhoster.com/bad_result.png
Re: Overlay transparanty bug
Posted: 2012-10-28T00:58:16-07:00
by Marcel71
ps. the
works also. But for 70% opacity the multiply is 0.3 so i need some extra calculation
But still i would think that -evaluate set 70% should work to, but i am glad i have a work-around.
Re: Overlay transparanty bug
Posted: 2012-10-28T15:27:03-07:00
by snibgo
There are a number of issues here.
1. There may be a bug in IM's resize.
Code: Select all
convert hearts.png -resize 166x165 h1.png
Pixels in hearts.png that were tranparent white become transparent black in h1.png, so they all have the same colour. (This may be because they are stored as one bit in hearts.png.) This is why, when you set them to the same alpha, they all look the same.
2. If you omit the resize but set the pixels to all the same transparency ("-set alpha 70%"), you get a blackish snowflake on a whitish background. This is the expected behaviour, but not the effect you want, apart from being the wrong size.
3. Multiplying the alpha by a certain amount gives the effect you want. Although the behaviour in (1) still occurs, it doesn't matter, because transparent pixels remain transparent (zero multiplied by anything remains zero).