How to add border/stroke to image?

Post questions on how to use or achieve an effect in Inkscape.
lodenmuse
Posts: 1
Joined: Thu Feb 28, 2008 2:19 am

How to add border/stroke to image?

Postby lodenmuse » Thu Feb 28, 2008 2:26 am

This seems simple, but why can't I figure out how to do it?

I can draw a box and adjust it's stroke--good. But I want to add a border/stroke to an image. No can do. I open or import any image and the stroke settings do nothing to it.

So how do I add a border or stroke to this image?

DannyKing
Posts: 122
Joined: Sat Jan 26, 2008 2:58 am
Location: UK
Contact:

Re: How to add border/stroke to image?

Postby DannyKing » Thu Feb 28, 2008 3:17 am

I don't think you can.

Here's a work around:

1. Select your image using the select tool :tool_selector: and look at the top. Note the (W)idth and (H)eight of your image.

2. Create a new rectangle and set the exact same width and height (you can edit the values you just noted)

3. Select both the image and the rectangle (drag a box around them with select tool) and press shift+ctrl+a (align and distribute dialog will pop up). Click center on horizontal axis and center on vertical axis (middle buttons of top section). This will center the rectangle and image to each other. One should completely overlap the other now.

4. If your rectangle is above the image select it and press the 'end' button on your keyboard to send it behind the image. While it is still selected, put a stroke on the rectangle. This should show up behind the image (and look like the image has a border). You should not be able to set the fill if you set the height and width of the rectangle correctly.

5. To make things easier, select both shapes and group them together (ctrl+g)
Image

DannyKing
Posts: 122
Joined: Sat Jan 26, 2008 2:58 am
Location: UK
Contact:

Re: How to add border/stroke to image?

Postby DannyKing » Thu Feb 28, 2008 3:21 am

A quicker way is to select your image and convert it to a pattern. (ctrl+i) or object>pattern>objects to pattern

You can then set a stroke on it, but personally I don't like doing this because I generally won't actually use that image as a pattern.
Image

User avatar
sas
Posts: 404
Joined: Sat Oct 06, 2007 5:42 am

Re: How to add border/stroke to image?

Postby sas » Thu Feb 28, 2008 3:48 am

lodenmuse wrote:I open or import any image and the stroke settings do nothing to it.


The reason this doesn't work is because images in SVG don't have stoke and fill properties.

So how do I add a border or stroke to this image?


I would suggest: duplicate the image (Ctrl+D), convert the duplicate to a pattern (Alt+I), then remove the pattern fill, add your stroke, and move the stroked rectangle to the bottom (assuming you don't want it covering the edges of the image).

This differs from DannyKing's second suggestion in that you're not using the image as a pattern - you're just using using objects-to-pattern as a way to quickly get a rectangle of the correct size in the correct place.

Guest

Re: How to add border/stroke to image?

Postby Guest » Thu Oct 07, 2010 10:35 am

Thanks DannyKing and sas!

That's exactly what I was looking for.
My image pattern is in a shade that is scaled and skewed. It's a bit glitchy when I modify the image used to create the pattern; weird effect occur on it like the scaled and skewed effect do not effect the pattern any more or the image pattern simply disappear. But it can be fix by moving the shade around than undo the move to put it back where it was.


Return to “Help with using Inkscape”