Clipping and export

Post questions on how to use or achieve an effect in Inkscape.
cujjo

Clipping and export

Postby cujjo » Fri Feb 19, 2010 1:05 am

I'm using the command line to convert svg files to png. Works great except that when a css background color is applied to the resulting png it extends to the square bounding box instead of the edge of the figure.

Essentially I need to be able to dynamically set a css background color and have it act as a fill for my round cornered and other odd shaped figures.

I know it's possible to do this because I see round and other irregular shaped png files on the web for which this works. If I understand what I've read here and elsewhere clipping the svg in Inkscape and exporting as png should accomplish this but I can't get it to work.

This is kicking my butt and really holding me up, some help GREATLY appreciated.

User avatar
prkos
Posts: 1625
Joined: Tue Nov 06, 2007 8:45 am
Location: Croatia

Re: Clipping and export

Postby prkos » Fri Feb 19, 2010 1:11 am

I'm not sure if I understand this correctly but do you want to export entire page or objects one by one? I think you can use an object ID to limit the export just to that object's area.

In GUI there's an option while exporting "Hide everything except selected". Maybe this is what you're looking for?
just hand over the chocolate and nobody gets hurt

Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download

cujjo

Re: Clipping and export

Postby cujjo » Fri Feb 19, 2010 1:42 am

I want to export the entire image as a png such that when I apply a css background to it that background does not extend past the edges of the shape, ie it does not extend to the rectangular bounding box of the png image.

I've tried creating a clip path by duplicating the shape, selecting both objects, select Object->Clip, then exporting all combinations of the page,drawing, object, and with the Hide Everything except Selected option with no luck.

When I try to use the exported png as an image and apply a background it extends outside of the shape. However if I do this same thing with other png's I've found online the background stays inside like a fill.

Driving me crazy.

cujjo

Re: Clipping and export

Postby cujjo » Fri Feb 19, 2010 1:56 am

Here is a page using png files that behave like I need: http://www.alifelessordinary.com/losalamos/dynamic_color/

I cannot get an exported png from Inkscape to do this, no doubt through my own stupidity.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Clipping and export

Postby brynn » Fri Feb 19, 2010 5:45 am

I don't know a lot about CSS, but if I understand your problem, I think you must have changed the background of your image from the default transparent to opaque. If the image background is transparent, it should be working as you want. Please look in File menu > Document Properties > Page tab > Background. There is a bar there that should be half some color and half checkerboard. If it's a solid color, then that's the problem.

Just click that bar, and a Background Color dialog will pop up that allows you to change the color and opacity. Look for the A, and move that slider all the way to the left. When you close the dialog, the Background bar will be half checkerboard.

If that doesn't solve your problem, then I have misunderstood. Let us know what happens :D

User avatar
prkos
Posts: 1625
Joined: Tue Nov 06, 2007 8:45 am
Location: Croatia

Re: Clipping and export

Postby prkos » Fri Feb 19, 2010 5:48 am

Are the document boundaries the same as the image boundaries? Go to Document Properties and you can use "Fit page to selection". So when you're exporting "Page" it will be the same size as your image.
just hand over the chocolate and nobody gets hurt

Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download

User avatar
RobA
Posts: 335
Joined: Fri Aug 10, 2007 1:22 am

Re: Clipping and export

Postby RobA » Sat Feb 20, 2010 1:58 am

cujjo wrote:Here is a page using png files that behave like I need: http://www.alifelessordinary.com/losalamos/dynamic_color/

I cannot get an exported png from Inkscape to do this, no doubt through my own stupidity.


It is a "trick". That example uses a png that is transparent in the middle (inside the smiley) and white in the surrounding box (It is the white that is blocking out the CSS background). Attached is a SVG that will give you the same result and here is a screen grab:
2010-02-19_105414.jpg
2010-02-19_105414.jpg (195.78 KiB) Viewed 1314 times


Note - I create a BG layer filled with a checkerboard pattern to see the transparency. It should be turned off before export.

-Rob A>
Attachments
ts.svg
(8.16 KiB) Downloaded 177 times


Return to “Help with using Inkscape”