Set Background Transparency

Asked by Stefan Salmon

Hi,

I have imported a PNG file which has a white background. I want to save it as an SVG but set the white background to transparent.
Is there an easy way of doing this?

Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Solved by:
Hachmann
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
Hachmann (marenhachmann) said :
#3

Hi Stefan,

no, there isn't. As a vector editor, Inkscape only has limited support for editing raster images.

In Inkscape, you can:

- vectorize the image (Path -> Trace bitmap), if it is suitable for vectorization and if it would benefit your image quality (i.e. you need high resolutions).
- redraw the image (i.e. trace manually)
- use clipping (draw a path around the borders of the image contents, then use it as a clip path, via Object -> Clip -> Set)
- play with the 'channel transparency' or 'light eraser' filter, to make a specific color / white transparent (only works if there is no white within the contents of the image)

Outside Inkscape, you can:
- use a raster graphics editor, such as Gimp. This is probably the fastest solution (it has a magic wand tool that can auto select areas of identical color, and also an intelligent background/foreground selection tool). Then import the image into Inkscape.

Kind Regards,
 Maren

Revision history for this message
Stefan Salmon (fetsnomlas) said :
#4

Hi Maren,

Thanks for your reply.

If I open the PNG image in Gimp and set the background to transparent, if I then bring it into Inkscape will the background remain transparent for exporting as an SVG or can this all be done in Gimp?

Thanks.

Revision history for this message
Best Hachmann (marenhachmann) said :
#5

Hi Stefan,

the background of an imported, transparent png will remain transparent when saved embedded in an Inkscape SVG, yes.

But:

if there are only raster graphics in your image, then SVG is not the ideal file format to use.
There's no gain in embedding raster images in an SVG vs. combining them into a png with, for example, gimp.

If, on the other hand, you plan to combine raster and vector elements in your picture, then SVG can be a good choice.
Note that saving raster images in an SVG will not magically turn them into vector objects, and thus they will not be scalable without loss of quality/sharpness. They remain the same old pixel objects, with each pixel being visible, depending on zoom.

Hope this helps a bit,
Kind Regards,
 Maren

Revision history for this message
Stefan Salmon (fetsnomlas) said :
#6

Hi Maren,

Thanks again for the detailed reply. I understand exactly what you mean.

Revision history for this message
Stefan Salmon (fetsnomlas) said :
#7

Thanks Hachmann, that solved my question.