Search code examples
image-processingimagemagickpngimagemagick-convert

How to fade images to blue with image magic?


Much like this question 3, im trying to achieve a fade but to a constant color rather than fade to transparent, how can the fade at all the edges, go to blue rather than to transparent? I have tried the following:

convert doge.png -alpha set -virtual-pixel transparent -background blue  -channel A -morphology Distance Euclidean:1,20\! +channel _doge.png
convert doge.png -alpha set -virtual-pixel Blue  -channel A -morphology Distance Euclidean:1,20\! +channel _doge.png

unsuccessfully. I also considered vignette 4 which it turns out produces very stretched ovals on my very rectangular images, making them unattractive, therefore i have a need to keep the fade to black rectangular, if i can use this fade to produce a fade to black it would suffice.

with the first command i get this, before and after: Before, After The second command errs out with this error:

convert: unrecognized virtual pixel method `Blue' @ error/convert.c/ConvertImageCommand/3177.

Solution

  • Your doing the morphology on the Alpha channel, but what about just the Red & Green channels.

     convert doge.png -alpha set -virtual-pixel transparent -background blue \
             -channel RG -morphology Distance Euclidean:1,20\! +channel _doge.png
    

    doge