how to dig a hole of specified size from a JPG image
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how to dig a hole of specified size from a JPG image
Save the original alpha channel. Then create a mask for you hole. Then multiply the alpha channel and the mask. Then put the result back into the alpha channel of the original image.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how to dig a hole of specified size from a JPG image
Sorry, I do not code in your API, but only using the command line.
Here is how to do it in command line:
Here is how to do it in command line:
Code: Select all
magick 58a40d9d85367.png \
\( -clone 0 -alpha extract \) \
\( -clone 0 -alpha off -fill white -colorize 100 -fill black -draw "rectangle 200,200 400,400" -alpha off \) \
\( -clone 1 -clone 2 -compose multiply -composite \) \
-delete 1,2 -alpha off -compose copy_opacity -composite result.png