Bordery of Photo Soften / "Fade out"

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
anthony
Posts: 8871
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony » 2006-12-10T18:58:55-07:00

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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

rmagick
Posts: 245
Joined: 2006-03-16T17:30:48-07:00
Location: Durham, NC, USA

Post by rmagick » 2006-12-11T20:20:02-07:00

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]

User avatar
anthony
Posts: 8871
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony » 2006-12-11T21:08:02-07:00

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...
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/

Post Reply