Page 1 of 1

Add semi-transparent inner border over source image

Posted: 2014-04-28T02:26:49-07:00
by christiaan
First, I've searched the forum and docs but I can't find a similar question to mine. I hope you all can help me.

I want to add an semi-transparent surrounding inner-border of 20 pixels (for example) to a single jpg image. With -shave and -border I've created the inner border effect already, but I've lost all image information "under" the border then. Transparency will not succeed anyhow then.

Things that crossed my mind to solve this (but need help in the right direction):
- Create a transparent image (with the same size as original), give that the -shave and -border commands and create a composition with -blend over the original.
- Create 4 transparent boxes as borders (but I think it should be much more easier)

I think this should not be as hard as it seems, but I can't find a way to get started.

Thanks!

Re: Add semi-transparent inner border over source image

Posted: 2014-04-28T05:52:13-07:00
by snibgo
It could be something like this Windows BAT script:

Code: Select all

convert ^
  logo: ^
  ( +clone -alpha Transparent ^
    -shave 20x20 ^
    -bordercolor None ^
    -mattecolor brown -frame 20x20 ^
    -channel A -evaluate Multiply 0.75 ^
  ) ^
  -composite ^
  t.png
Instead of "-bordercolor None -mattecolor brown -frame 20x20", do whatever you want.

Re: Add semi-transparent inner border over source image

Posted: 2014-04-29T15:58:37-07:00
by christiaan
Thanks snibgo, exactly as I needed! This proves again this forum is a great way of IM support :)