Marcel
Marcel

Reputation: 984

Convert a black & white image to white & transparent

I have a black and white System.Drawing.Bitmap being passed from a 3rd party SDK, that I want to convert from black on white to white on transparent... i.e. make all the black pixels white, and all the white pixels transparent.

Do I have to iterate over every pixel, check the color and change it accordingly? How do I go about this?

Upvotes: 0

Views: 579

Answers (1)

Matteo Italia
Matteo Italia

Reputation: 126927

If it's a paletted image (as it should be, given that it's a BW image) you could replace black with transparent inside the palette of the bitmap (Palette property of Bitmap, edit its Entries property).

Upvotes: 1

Related Questions