Page 1 of 1

Posted: 2006-12-10T18:58:55-07:00
by anthony
You are not very clear in your desires.

Are you wanting to add a color edge (like border), or something else.
See IM Exampes Borders
http://www.cit.gu.edu.au/~anthony/graph ... op/#border

Posted: 2006-12-11T20:20:02-07:00
by rmagick
I think this script will do what you want. The tricky part is figuring out the dimensions of the opaque part. For simplicity it always makes the opaque part be 75% of the image's width and height. Of course you can change the "75 / 100" arithmetic to whatever fraction you want.

Save this code in a file named "vig.sh" and call it like this:

vig.sh <input-filename> <output-filename>

[code]
#! /bin/bash -x

IMG=$1
DIMS=`identify -format "%w:%h" $IMG`
COLS=`echo $DIMS | cut -d: -f1`
ROWS=`echo $DIMS | cut -d: -f2`

HT=`expr $ROWS \* 75 / 100`
WD=`expr $COLS \* 75 / 100`
X1=`expr \( $COLS - $WD \) / 2`
Y1=`expr \( $ROWS - $HT \) / 2`
X2=`expr $X1 + $WD`
Y2=`expr $Y1 + $HT`

convert -size ${COLS}x${ROWS} xc:black \
-stroke white -fill white -draw "roundrectangle $X1,$Y1 $X2,$Y2 12,12" \
-blur 0x10 +matte mask.miff

composite -compose CopyOpacity mask.miff +matte $IMG $2

rm mask.miff
[/code]

Posted: 2006-12-11T21:08:02-07:00
by anthony
Okay, I now understand....

But those are not very simple...

My simple, but very tricky solution...

Code: Select all

   convert  image.png   -matte -virtual-pixel transparent -channel A \
                 -blur 0x5 -fx '(u-.51)*2.1'  soft_edge.png
The size of the soft edge is controlable by the '-blur'
You can now -flatten or -compose it onto the background of your choice!

Added this to thumbnails section.
http://www.cit.gu.edu.au/~anthony/graph ... #soft_edge

Enjoy...