Re: Reduce the number of commands
Posted: 2010-01-25T16:58:40-07:00
Pete,
I don't think you need to subtract 1 from w and h.
this works fine for me in Unix (using my string --- note Anthony's original method used the file approach)
infile="hatching_orig.jpg"
drawcmd=`convert $infile -define jpeg:size=300x300 -thumbnail "300x300>" \
-format "roundrectangle 1,1 %[fx:w],%[fx:h] 25,25" info:`
convert $infile -thumbnail "300x300>" \
\( +clone -threshold "100%" -fill white -draw "$drawcmd" \) \
-alpha off -compose CopyOpacity -composite \
-background none -compose Over -gravity center -extent 300x300 \
thumbnail_rounded_in_one2.png
I would have done it this way myself using copyopacity, but I was just following Anthony's example. He knows more about compose methods. I really am not too familiar with DstIn, myself.
Note, your point about resetting the -compose method to over, is important in things like -extent and -border and the like, even -blur, when you use other compose methods in parenthesis. Seems as though -respect parenthesis does not respect this aspect. Good catch.
Similarly, there have been times that I have also had to reset the geometry (using +geometry) in similar like situations where -respect parenthesis is not honoring that.
Fred
I don't think you need to subtract 1 from w and h.
this works fine for me in Unix (using my string --- note Anthony's original method used the file approach)
infile="hatching_orig.jpg"
drawcmd=`convert $infile -define jpeg:size=300x300 -thumbnail "300x300>" \
-format "roundrectangle 1,1 %[fx:w],%[fx:h] 25,25" info:`
convert $infile -thumbnail "300x300>" \
\( +clone -threshold "100%" -fill white -draw "$drawcmd" \) \
-alpha off -compose CopyOpacity -composite \
-background none -compose Over -gravity center -extent 300x300 \
thumbnail_rounded_in_one2.png
I would have done it this way myself using copyopacity, but I was just following Anthony's example. He knows more about compose methods. I really am not too familiar with DstIn, myself.
Note, your point about resetting the -compose method to over, is important in things like -extent and -border and the like, even -blur, when you use other compose methods in parenthesis. Seems as though -respect parenthesis does not respect this aspect. Good catch.
Similarly, there have been times that I have also had to reset the geometry (using +geometry) in similar like situations where -respect parenthesis is not honoring that.
Fred