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
Bordery of Photo Soften / "Fade out"
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
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]
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]
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Okay, I now understand....
But those are not very simple...
My simple, but very tricky solution...
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...
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
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...
Last edited by anthony on 2006-12-12T06:32:47-07:00, edited 1 time in total.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/