Make borders not rounded - modifying fmw42's contour script
Posted: 2018-11-29T11:50:21-07:00
I'm modifying @fmw42's awesome contour script. I want to first make the borders not rounded and follow exactly the contour of the original image.
Source Image
Result Image How do I modify the script to perfectly follow the contour of the image? In this example the border should be perfectly square, not rounded.
Source Image
Code: Select all
convert \
\( bb0e6dd421df72541a79f271fb4f1a90.png -bordercolor white -border 1 \
-alpha off -fuzz 1% -fill none \
-draw "matte 0,0 floodfill" \
-fuzz 2 -trim +repage \
-bordercolor none -border 50 \
-background white -alpha background \
-alpha off -write mpr:img -alpha on \
-alpha extract -morphology dilate disk:20 \
-blur 0x1 -level 0x75% -write mpr:msk1 +delete \) \
\( mpr:msk1 -negate -fill "gray(95%)" -opaque black \
-fill "white" -opaque white \
-blur 0x10 -write mpr:msk2 +delete \) \
\( mpr:msk1 -morphology edgein diamond:1 -negate -write mpr:edg +delete \) \
mpr:img mpr:msk1 -alpha off -compose copy_opacity -composite \
mpr:msk2 -reverse -compose over -composite \
"testing.png"