I am working with Bitmap C# and wondering how to convert a color png image to only one color. I want all the visible colors in the image to become white. The parts that are transparent should remain transparent. I am going to display these agains a grey background.
Just import your PNG image in the editor on the left, set the desired opacity level in the options, and you'll instantly get a semi-transparent PNG on the right. Free, quick, and very powerful. Import a PNG – change its opacity.
To make a color transparent in Photoshop, go to Select > Color Range. Click on the color you want to remove, then hold Shift to add additional colors to the selection. Adjust the Fuzziness slider until your subject is white then click OK. Lastly, press Delete to make the selected colors transparent.
GIF and PNG‑8 formats support one level of transparency—pixels can be fully transparent or fully opaque, but not partially transparent.
If the image doesn't use alpha channel for transparency then the following will do:
Bitmap image;
for (int x = 0; x < image.Width; x++)
{
for (int y = 0; y < image.Height; y++)
{
if (image.GetPixel(x, y) != Color.Transparent)
{
image.SetPixel(x, y, Color.White);
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With