Contour cut images

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?".
User avatar
fmw42
Posts: 23668
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Contour cut images

Post by fmw42 » 2017-04-02T11:33:41-07:00

I wrote a Unix bash shell script, contour, to do this and allows the image to be opaque (constant background color), transparent or a mask provided. It also allow the user to change the background color in the output. Give it a try if you like and let me know if that helps you. See my link below.

burtonian029
Posts: 5
Joined: 2018-06-26T20:44:13-07:00
Authentication code: 1152

Re: Contour cut images

Post by burtonian029 » 2018-06-29T20:32:55-07:00

fmw42 wrote:
2017-03-31T09:59:55-07:00
replace the -transparent with -draw "matte 0,0 floodfill"

Code: Select all

convert 3b01580253b94dce89bbbf3aa30b7b17.png -trim +repage -alpha off mario2.png
convert \
\( mario2.png \
    -trim +repage \
    -bordercolor white -border 40 \
    -fuzz 5% -fill none -draw "matte 0,0 floodfill" \
    -alpha off -write mpr:img -alpha on \
    -alpha extract -morphology dilate disk:20 \
    -blur 0x1 -level 0x50% -write mpr:msk1 +delete \) \
\( mpr:msk1 -negate -fill gray30 -opaque black -blur 0x10 \
    -fill gray95 -opaque gray30 -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 \
mpr:edg -compose multiply -composite \
mario2_result2.png
Image
Fred, we are trying to accomplish the same thing with our sticker site. Currently we have parameters like this: -d 25 -s 0 -r 0 -f 0 -m floodfill -h off
However, after reading some of the previous posts we are probably missing more than wrong parameters to input. We have got it looking good for shapes, but text is what we are trying to figure out now, and we have tried a few variations of parameters. Here is an example screenshot: https://gm1.ggpht.com/jH3Bm0lsLiad3diyC ... 630-l75-ft
Basically we would like to achieve one single contour line around the outside with the inside filled with white. Currently in the example link there are holes in the O and other parts. We have the shapes very similar to the Mario, but without the shadow effect, and this was done using the contour script. If you or anyone has any input it would be appreciated. Thanks!

User avatar
fmw42
Posts: 23668
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Contour cut images

Post by fmw42 » 2018-06-29T21:55:46-07:00

Your link does not work for me. 403 Error.

burtonian029
Posts: 5
Joined: 2018-06-26T20:44:13-07:00
Authentication code: 1152

Re: Contour cut images

Post by burtonian029 » 2018-06-29T23:01:41-07:00

fmw42 wrote:
2018-06-29T21:55:46-07:00
Your link does not work for me. 403 Error.
sorry about that! https://prnt.sc/k12jj2 this one should work. thank you!

burtonian029
Posts: 5
Joined: 2018-06-26T20:44:13-07:00
Authentication code: 1152

Re: Contour cut images

Post by burtonian029 » 2018-06-29T23:06:11-07:00

here is one of our predefined shapes with the same code and it works pretty well for previews like this on our predefined shapes: https://prnt.sc/k12k1n
but havent figured out the text yet.

User avatar
fmw42
Posts: 23668
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Contour cut images

Post by fmw42 » 2018-06-29T23:23:53-07:00

Sorry, but I still do not understand the issue. Can you show me an example from my script contour that does not work the way you want and explain the issue.

burtonian029
Posts: 5
Joined: 2018-06-26T20:44:13-07:00
Authentication code: 1152

Re: Contour cut images

Post by burtonian029 » 2018-06-29T23:37:32-07:00

fmw42 wrote:
2018-06-29T23:23:53-07:00
Sorry, but I still do not understand the issue. Can you show me an example from my script contour that does not work the way you want and explain the issue.
we are trying to get it to look like these examples without the shadow and instead of shadow we will just use one 1px or 2px grayish line to give the sticker shape on a white background when previewing. however, the real issue is we cannot get the inner white fill. ours is full of holes and extra lines compared to the examples. https://prnt.sc/k12opa https://prnt.sc/k12pdu https://prnt.sc/k12pmr
you can see the difference in their images compared to ours. they have one continuous outer line only, and the inner fill is all white except for the actual graphic. the outer line also makes a nice contour line to give the words shape for a sticker. it is with text only and it works great for our premade sticker shapes. i hope that helps clear it up some. thanks fred.

User avatar
fmw42
Posts: 23668
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Contour cut images

Post by fmw42 » 2018-06-30T10:02:54-07:00

I do not see the holes you mention. Which image is theirs (and who is they) and which is from my script? If you would like to take this offline, you may contact me directly (fmw at alink dot net). Please provide an example from my script and mark on it what is wrong and explain what you would like. Show me something similar that shows what you want for the same text. We can discuss customizing the script if you would like.

Post Reply