Page 2 of 2

Re: Reduce the number of commands

Posted: 2010-01-25T16:58:40-07:00
by fmw42
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

Re: Reduce the number of commands

Posted: 2010-01-25T20:17:32-07:00
by el_supremo
I don't think you need to subtract 1 from w and h
While I was testing this with logo: as input, it was giving me a one pixel black line along the top of the image and subtracting one fixed it. Also, the description of roundrectangle says that those values are the coordinates of top left and bottom right corners of a rectangle which in this case would be 0,0 w-1,h-1.

Pete

Re: Reduce the number of commands

Posted: 2010-01-25T20:19:44-07:00
by fmw42
Also, the description of roundrectangle says that those values are the coordinates of top left and bottom right corners of a rectangle which in this case would be 0,0 w-1,h-1
Pete,

I think you are right about using w-1 and h-1 per your comment about the lower right corner of the image's coordinates. My mistake. It also smoothes/rounds the corners better than with w and h. Thanks for catching that.

Fred