Composite + gravity using -compose Xor

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
jnimo

Composite + gravity using -compose Xor

Post by jnimo »

Hello again and thanks for all the help that you have give me until today :D


I have another problem, perhaps someone could help me with this. I have 2 image SD.png and inside.jpg, SD.png is a rounded image (like a 1/4 of a circle) black and transparent and inside.jpg is a picture, I want to use this image (SD.png) to make a rounded corner in the image, so I have use this comand

Code: Select all

composite -compose Xor -gravity NorthEast SD.png inside.jpg out.png
It works because it leave the transparent part but it does too leave the black part and I need that to work like copyopacity, I have try too to use this other command

Code: Select all

composite -gravity NorthEast -compose copyopacity SD.png inside.jpg out.png
but it just leave a big transparent image, so if someone could help I will be really apreciate. thanks

Jimmy Nimo
jnimo

Re: Composite + gravity using -compose Xor

Post by jnimo »

I have found a workaround but I don't think it the best approach

Code: Select all

composite -compose Src -gravity NorthEast SD.png inside.jpg temp2.png
convert temp2.png -transparent white temp3.png
composite -compose copyopacity temp3.png inside.jpg salida2.png
composite -compose Src -gravity Southwest II.png inside.jpg temp2.png
convert temp2.png -transparent white temp3.png
composite -compose Dst_in temp3.png salida2.png salida3.png
composite -compose Src -gravity Southeast ID.png inside.jpg temp2.png
convert temp2.png -transparent white temp3.png
composite -compose Dst_in temp3.png salida3.png salida4.png
composite -compose Src -gravity Northwest SI.png inside.jpg temp2.png
convert temp2.png -transparent white temp3.png
composite -compose Dst_in temp3.png salida4.png def.png


in def.png I have the image I want but, come on it has to be another way to do this, I fell that I'm making to much work for this, any Ideas?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Composite + gravity using -compose Xor

Post by fmw42 »

post your images so we can try to give you a good method to follow and test it.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Composite + gravity using -compose Xor

Post by Bonzo »

Is this what you are looking to do ?
Image

Code: Select all

convert -size 637x140 xc:none -fill white -draw "roundRectangle 0,0 637,140 15,15" albir.jpg -compose SrcIn -composite rounded_corners.png 
jnimo

Re: Composite + gravity using -compose Xor

Post by jnimo »

yes I want that but I want to control the smothness of the rounded corner, so I'm trying to make in that approach, can I control the rounded edge with that command?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Composite + gravity using -compose Xor

Post by Bonzo »

Not completly sure what you mean but:
roundRectangle 0,0 637,140 15,15 - 15,15 is the size of the corner radii
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Composite + gravity using -compose Xor

Post by anthony »

For an alterantive that does not require for knowledge of the image size see IM Examples, Thumbnails, Rounded Corners
http://www.imagemagick.org/Usage/thumbnails/#rounded
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply