Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you set pixels to be transparent in a .GIF or .PNG file in Visual Studio 2008's drawing editor?

My graphic artist gave me a .PNG file, then the same file as a .GIF. When I save it, the transparent background pixels actually get set to white pixels. At one time I thought VS could do transparent colors with this little pink/salmon retro-tv looking icon in the color palette, but it's not showing up any more.

Anybody have any ideas?

like image 286
franji1 Avatar asked May 23 '12 18:05

franji1


2 Answers

Open the file gif/png with the Visual Studio Editor

In the properties window select a format that supports the alpha channel i.e. 32bpp BGRA

Using the eraser tool now will set those pixels to transparent.

like image 174
Michael Cowley Avatar answered Sep 21 '22 12:09

Michael Cowley


In Visual Studio 2015 image editor, I found an easy way to do this with the eraser tool.

  1. First fill the background which you want to make transparent with an adequately unique color(not really necessary I think, after some trials.. It's up to you to try) that is not in the picture.
  2. Then select the tool used to 'select an area of similar color'.
  3. Then click on the background you filled with new color. Only the area you need to make transparent will be selected.
  4. Now use the eraser tool with as much size(erase width in properties) as you want to easily erase the opaque background. The eraser won't erase the picture you need.

Then click outside the picture to clear the selection and you get the picture with the transparent background! This method just takes seconds to finish, as compared to using just the eraser tool. Just sometimes, you may need to touch up the picture, as some minor part of required image may be cleared.

NOTE: You must set the format to '32bpp BGRA' to do this.

EDIT: I found that you don't even need an eraser tool. After step 3, press delete, and the background is gone!

like image 27
TGURUB Avatar answered Sep 19 '22 12:09

TGURUB