Fill transparent areas with color

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?".
Post Reply
Posts: 10
Joined: 2018-08-23T11:50:07-07:00
Authentication code: 1152

Fill transparent areas with color

Post by ifkey »

I need to stroke around the image and fill in the transparency image.
Found an example on the Internet

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

Re: Fill transparent areas with color

Post by fmw42 »

Your images have no transparency. Always post your original images (so we can use it for processing). Also provide your IM version and platform. The way to handle this is by dilating the alpha channel using -morphology.

Unix syntax:

Code: Select all

convert image \( -clone -fill blue -colorize 100 \) \( -clone -alpha extract -morphology dilate disk:5 \) -alpha off -compose copy_opacity -composite result.png
If using IM 7 change convert to magick.

Post Reply