Re: fast IM code to add rounded corners to image with known
Posted: 2012-03-15T14:54:51-07:00
Might there be a virtual canvas left behind each corner. Have you tried adding +repage before writing to .mpc?
Use https://github.com/ImageMagick/ImageMagick/discussions instead.
https://download.imagemagick.org/discourse-server/
https://download.imagemagick.org/discourse-server/viewtopic.php?t=20531
Code: Select all
convert -size 16x16 xc:none -draw "fill white rectangle 0,0 15,15 fill black circle 15,15 15,0" -background white -alpha shape +repage -strip RoundCorner8NW.mpc
convert -size 16x16 xc:none -draw "fill white rectangle 0,0 15,15 fill black circle 0,15 0,0" -background white -alpha shape +repage -strip RoundCorner8NE.mpc
convert -size 16x16 xc:none -draw "fill white rectangle 0,0 15,15 fill black circle 15,0 0,0" -background white -alpha shape +repage -strip RoundCorner8SW.mpc
convert -size 16x16 xc:none -draw "fill white rectangle 0,0 15,15 fill black circle 0,0 15,0" -background white -alpha shape +repage -strip RoundCorner8SE.mpc
convert RogerRabbit.mpc \
RoundCorner8NW.mpc -gravity northwest -composite \
RoundCorner8NE.mpc -gravity northeast -composite \
RoundCorner8SW.mpc -gravity southwest -composite \
RoundCorner8SE.mpc -gravity southeast -composite \
-quality 70 FramedRogerRabbit.jpg
Code: Select all
MAGICK_THREAD_LIMIT=2 convert RogerRabbit.mpc RoundCorner8NW.mpc -gravity northwest -composite RoundCorner8NE.mpc -gravity northeast -composite RoundCorner8SW.mpc -gravity southwest -composite RoundCorner8SE.mpc -gravity southeast -composite -quality 70 FramedRogerRabbit.jpg
I actually don't know. See below. But it would not surprise me.anthony wrote:From your examples I gather tha tyou are saying that re-drawing the corners is faster than flipping and floping
Warning: I never include the time it takes to prepare the .mpc mask files because for my target use they are recycled for every incoming original image, and are put in ramdisk. That is: they are "hoisted out of the loop."anthony wrote:also reading prepared MPC files is faster that fliping and flopping using parenthesis?
Now that I find interesting!
I figured as much: You're going for "transparent and standardized code structure" and I'm going for speed at all cost.anthony wrote:...Basically I divided the operations into 'setup' or 'initialization' operations set, and then a 'apply to image' operations set...