0

I have a PNG image which has two figures, bounded by black lines, against a purely white background. My figures have also some white "pixels" (dots, points) inside, not contiguous with background "pixels". Use of the word pixel is not meant to be technically strict. I mean to get an image with transparent instead of white background, same as if it were generated from the get-go, by removing all contiguous white pixels. This seems something attainable. Preferably with Inkscape.

I tried this, but the result was not good.

Later I found

Remove Background in Inkscape

9
  • 3
    If you have pixels, then you are surely working with raster (pixel-based) images, not vector graphics. Inkscape is a tool for vector graphics.
    – Juancho
    Mar 5, 2019 at 18:30
  • @Juancho - I mentioned pixels but I am not sure I have them, I am importing png files into Inkscape. Mar 5, 2019 at 19:19
  • PNGs are raster images, not vector. If you import them into Inkscape, they are still raster images. Use a raster image editor instead.
    – Billy Kerr
    Mar 6, 2019 at 0:28
  • @BillyKerr - So you mean that removing the contiguous background region of a given single color (white here) is not possible with PNGs in Inkscape? Mar 6, 2019 at 9:03
  • 1
    I mean you can't edit pixels in Inkscape, and there is no way to select any pixels in a raster image and modify them. You could add a vector clipping path to a raster image, but it's manual work - literally drawing a path around the image.
    – Billy Kerr
    Mar 6, 2019 at 9:42

1 Answer 1

1

I understand your desire to work in Inkscape, that is OK, however, I would edit the imported PNG in bitmap editor first, then use it in Inkscape for vector-like work.

For example in Gimp:

1) Open bitmap file

2) In the layers, right-click the only layer there and select "Add alpha channel" (this will allow transparency)

2) Click magic stick selection tool

3) Click to the white area (or more, with shift) you want to make transparent and press delete

4) Press CTRL+E for exporting edited bitmap and save as new PNG.

5) Use that PNG in Inkscape.

EDIT:

You've mentioned automated processing in your comment. You can do automated processing with GIMP (https://www.gimp.org/tutorials/Basic_Batch/). However I haven't done that before; even though I use GIMP for desktop editing, I used ImageMagic for batch conversions.

Here is how you batch-remove background with ImageMagic: https://imagemagick.org/Usage/masking/#bg_remove

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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