Discussion:
Border with an offset
Claus Cyrny
2010-06-01 20:27:57 UTC
Permalink
Hi all,

I'm having a hard time drawing a border around an image.
The image actually /does/ have a white border (width: 100 px)
already, but I would like IM to draw an additional small, grey line
inside this white area. How do I go about there? I'm actually a bit
unsure about the proper syntax.

TIA,

Claus
--
Djangology <http://home.arcor.de/ccyrny/djangology/> | django|log
<http://djangolog.twoday.net/>| Flickr
<http://www.flickr.com/photos/claus_01/> | artificial 1.0: visual arts
blog <http://artificial10.wordpress.com/>
Fred Weinhaus
2010-06-01 23:01:16 UTC
Permalink
Post by Claus Cyrny
I'm having a hard time drawing a border around an image.
The image actually /does/ have a white border (width: 100 px)
already, but I would like IM to draw an additional small, grey line
inside this white area. How do I go about there? I'm actually a bit
unsure about the proper syntax.
There are two ways.

1) Find the coordinates in the upper left corner and lower right
corner within the white area from the dimensions of the image and the
width of the white border where you want to draw the gray border,
then just draw a rectangle with some strokewidth and stroke gray and
-fill none

convert image -fill none -stroke gray -strokewidth 10 -draw
"rectangle $x1,$y1 $x2,$y2" result

2) Use -shave to remove 50 pixels around the image, then use
-bordercolor gray -border XX to add your gray border, then use
-bordercolor white -border 50 to add another 50 pixels (or whatever
you want) of white around the gray border.

convert image -shave 50x50 -bordercolor gray -border 10 -bordercolor
white -border 50 result


Fred
Claus Cyrny
2010-06-02 06:34:19 UTC
Permalink
Hi Fred,

thanks, #1 worked.

Claus
Post by Fred Weinhaus
Post by Claus Cyrny
I'm having a hard time drawing a border around an image.
The image actually /does/ have a white border (width: 100 px)
already, but I would like IM to draw an additional small, grey line
inside this white area. How do I go about there? I'm actually a bit
unsure about the proper syntax.
There are two ways.
1) Find the coordinates in the upper left corner and lower right
corner within the white area from the dimensions of the image and the
width of the white border where you want to draw the gray border,
then just draw a rectangle with some strokewidth and stroke gray and
-fill none
convert image -fill none -stroke gray -strokewidth 10 -draw
"rectangle $x1,$y1 $x2,$y2" result
--
Djangology <http://home.arcor.de/ccyrny/djangology/> | django|log
<http://djangolog.twoday.net/>| Flickr
<http://www.flickr.com/photos/claus_01/> | artificial 1.0: visual arts
blog <http://artificial10.wordpress.com/>
Anthony Thyssen
2010-06-02 00:31:06 UTC
Permalink
On Tue, 01 Jun 2010 22:27:57 +0200
magick-users-***@imagemagick.org wrote:
| Hi all,
|
| I'm having a hard time drawing a border around an image.
| The image actually /does/ have a white border (width: 100 px)
| already, but I would like IM to draw an additional small, grey line
| inside this white area. How do I go about there? I'm actually a bit
| unsure about the proper syntax.
|
You want to draw a border in an existing border.

Two solutions

Draw a rectangle

that may require some calculations however.

The other solution remove the existing border, add your new one
re-add the old border

-shave 100x100 \
-bordercolor LightGrey -border 1x1 \
-bordercolor white -border 99x99



Anthony Thyssen ( System Programmer ) <***@griffith.edu.au>
--------------------------------------------------------------------------
That's the thing about people who think they hate computers.
What they really hate is lousy programmers.
- Larry Niven and Jerry Pournelle, "Oath of Fealty"
--------------------------------------------------------------------------
Anthony's Castle http://www.cit.griffith.edu.au/~anthony/
Loading...