4

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.

Community
  • 1
  • 1
cwd
  • 53,018
  • 53
  • 161
  • 198

1 Answers1

3

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

Kent
  • 189,393
  • 32
  • 233
  • 301
  • It looks like the top and left are clipped. How do you fix that? – icktoofay Oct 08 '11 at 20:40
  • You can add a transparent border using border and bordercolor options, like so: convert pic.png \( +clone -background black -shadow 50x15+9+15 \) +swap -bordercolor none -border 40 -background none -mosaic +repage new.png – codecraft Oct 08 '11 at 21:04
  • Hey @Kent - what is the `55x15+0+5` syntax? blur, offset, and transparency? – cwd Oct 09 '11 at 02:47