2

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?

  • To me, it is unclear what you like to achieve. If you put a ẃhite layer below your image, you lose the transparency. If you put a semitransparent polygon on your image, you can adjust the nodes to cover the areas, which shall be white. When ready adjusting them, you can set the filling to 100% white again and put the layer to lowest. Depending on the image, other ways of solving this might be more easy or complicated. The fill tool might be helpful. Or to copy the whole image, combine all paths. Set this new shape to white and put it to bottom, eventually deleting some nodes, where transparent – user unknown Aug 24 '16 at 18:35
1

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:

  1. 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".

  2. 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.

  3. 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.)

  4. 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.

  5. 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.