I have a SVG drawing with black foreground and white background.
What is the easiest way to change foreground to white and the background to transparent (in InkScape or similar free program)?
There is no easy single step procedure do do that! There is however a multi-step procedure available using InkScape.
To change the background to transparent go to File > Document Properties > Background and check the alpha channel (A). Set the value to 0 (zero).
However, if your drawing contains white objects overlaying another object, you should as an intermediate step set the background to a special color, say pink semi-transparent, to easy the following steps.
Changing the white objects color to transparent will not work, as the outer objects color will shine through (in my case black).
I used the following steps:
Step 1: Mark the outer outer (black) object, then shift mark the inner (white) object.
Step 2: Select Path > Difference (or Ctrl+-).
The inner object is deleted in the process, which is what we want here!
Repeat step 1 and 2 for other white objects.
Step 3: Fill all black objects with white.
Step 4: Change the background to fully transparent. Now your drawing disappears and appears all white. This is okay!
Finally save and export as PNG-image.