linuximageuniximage-processingsips

How can I add a transparent OS X style border to an image using command line tools?


I have images and want to add a transparent gradient background to them, similar to the way OS X does with window shadows.

Is there a way I can use something like mogrify or sips to add this border? The images I want to process are not screenshots, but let me show two screenshots so the effect I'm attempting is clear:

Flat image:

Picture.png

With transparent gradient:

Picture 1.png

This doesn't have to be exactly the same, just something similar and not a solid square border.


Solution

  • if you say "something similar" is also accepted. try the command below:

    kent$  convert yourPNG.png \( +clone -background black -shadow 50x15+9+15 \) +swap -background none -mosaic +repage new.png
    

    you need have Imagemagic installed.

    the result looks like this:

    enter image description here

    updated

    hope this time it meets your need

    kent$  convert yourPng.png \( +clone -background black -shadow 55x15+0+5 \) +swap -background none -layers merge  +repage new.png
    

    result:

    enter image description here