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.
Clipping and export
Re: Clipping and export
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?
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
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
Re: Clipping and export
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.
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.
Re: Clipping and export
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.
I cannot get an exported png from Inkscape to do this, no doubt through my own stupidity.
Re: Clipping and export
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
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

Basics - Help menu > Tutorials
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Re: Clipping and export
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
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
Re: Clipping and export
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:
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 176 times