composite blend small logo onto png fades the entire png

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
whibbitz
Posts: 2
Joined: 2016-02-17T12:15:24-07:00
Authentication code: 1151

composite blend small logo onto png fades the entire png

Post by whibbitz »

Hi, I am trying to add polygon with a label (and small image) in the bottom left of an image (see my links below). If my starting image is a jpg, then the logo and everything is applied just fine (it has some transparency in it). But if the starting image is a png, then the entire png is faded. I believe it has to do with how the -blend command is blending the image with alpha layers, but if i turn off alpha, then my logo with the polygon i drew does not have alpha.

here is the commmand I use with jpg, and it's result (which is what i want):

convert \( -size 118x148 xc:none -fill '#303030' -draw "polygon 18,0 18,18 0,18" +append \) \
\( -bordercolor '#303030' -border 0x36 -background '#303030' 'testLogo.jpg' +append \) \
\( -border 28x0 -splice 0x23 -size x110 -pointsize 90 -fill white label:'my dragon' +append \) \
-background '#303030' +append -quality 100 -scale 25% \
miff:- | composite -blend 70 -gravity southwest -quality 100 - in.jpg \
out.jpg

https://annotate.driftt.com/view?i=3hmg ... _2x.png%2F

BUT if i use a png as the input file, then the result is faded out (the dragon should not be faded out at all but very dark colored):

convert \( -size 118x148 xc:none -fill '#303030' -draw "polygon 18,0 18,18 0,18" +append \) \
\( -bordercolor '#303030' -border 0x36 -background '#303030' 'testLogo.jpg' +append \) \
\( -border 28x0 -splice 0x23 -size x110 -pointsize 90 -fill white label:'my dragon' +append \) \
-background '#303030' +append -quality 100 -scale 25% \
miff:- | composite -blend 70 -gravity southwest -quality 100 - in1.png \
out.png

https://annotate.driftt.com/view?i=wbmz ... _2x.png%2F

I tried adding an -alpha off after -blend, but that turns off the alpha on my polygon (which i want to have xc:none)..
I tried changing blend so it is -blend 70x100 but that doesn't blend any of the background image.

Is there a way to only apply the blend only to the part of the image that overlaps for the png case?

It's just complicated for me since i am doing a polygon and a label so there is a lot going on..

Thank you in advance!
whibbitz
Posts: 2
Joined: 2016-02-17T12:15:24-07:00
Authentication code: 1151

Re: composite blend small logo onto png fades the entire png

Post by whibbitz »

I was reading more and it seems that I want to use -dissolve here instead of -blend, and that works for me!

I guess i can leave this topic here to help anyone else.. or happy to delete it.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: composite blend small logo onto png fades the entire png

Post by Bonzo »

Good idea to leave it as it may be useful - also I do not know if you can delete it as users were deleting their posts and it was making threads very confusing!
Post Reply