Mobile app version of vmapp.org
Login or Join
Sent7350415

: How to make the background of an image opaque in Inkscape? I've created an image with a transparent background (by tracing a bitmap) in Inkscape, but now I think I need a white layer under

@Sent7350415

Posted in: #Inkscape

I've created an image with a transparent background (by tracing a bitmap) in Inkscape, but now I think I need a white layer under the image to fill in all the areas of the image that were white.

The final image will be placed on a primarily green background. When I do place it on the green background, all the areas of the image that should be white now show the green background!

How can I fix this? Can I somehow add a white layer under my transparent image?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Sent7350415

1 Comments

Sorted by latest first Latest Oldest Best

 

@Eichhorn212

You can set a background color for the document in Inkscape by opening the Document Properties dialog (File → Document Properties... or Shift+Ctrl+D) and clicking the color selector labeled "Background". This color is shown behind the drawing in Inkscape itself, and also used e.g. when exporting the drawing as a bitmap.

Unfortunately, many SVG renderers ignore the background color, so this is not a good solution if you want to e.g. use your SVG images on the web without rasterizing them. Instead, a simple workaround is to place an explicit opaque shape (typically, a rectangle) behind your drawing. To keep this background shape from interfering with editing, you can place it in a separate layer, like this:


Create a new layer (Layer → Add Layer... or Shift+Ctrl+N) below the lowest existing layer in your image (by default, you only have one layer) and name it e.g. "Backdrop".
The layer selector in the Statusbar, at the bottom of the Inkscape window, should now show that you're editing the Backdrop layer; if not, select it.
Draw a rectangle on this Backdrop layer that covers the entire image, and set its fill color to whatever you want as your background color. (The stroke should typically be set to none.)
For editing convenience, you may want to adjust the size of the backdrop rectangle so that it exactly matches your page size. To do that, select the arrow ("select and transform") tool from the Toolbox bar (or just press F1), select the rectangle, and then manually edit the position and size of the rectangle on the Tool Controls bar, setting X = 0, Y = 0, and W and H equal to the width and height of the document.
Finally, lock the Backdrop layer (from the Layers dialog, or just by clicking the lock icon next to the layer selector in the Statusbar), and switch back to the main layer. The backdrop will now show behind your image, but you can't accidentally select it while editing unless you unlock the layer again.


Note that this method is not limited to setting a single solid background color — you can just as easily use it to create gradient or pattern backgrounds, semitransparent backgrounds, round or other non-rectangular background shapes, etc. In fact, since the background is just another SVG image drawn beneath your main image, you can make literally any background you can draw in SVG.

By toggling the visibility of your background layer on and off (most easily done from the Layers dialog), you can also quickly preview how your image will look like on different backgrounds. In some cases, you might even want to create a background layer (or several!) for this purpose, even if you don't actually intend to include it in your final image.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme