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

7

13

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?

Amblyopia answered 23/5, 2012 at 18:48 Comment(2)
sorry... i guess i was double-thinking, lolGotland
fyi, the pink/salmon-tv looking icon in the color palette is in the ICON editor, not the bitmap editor.Amblyopia
A
18

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.

Adenitis answered 10/12, 2014 at 13:8 Comment(1)
Thanks. I missed the format part. I assumed if I imported a PNG Visual studio would be smart enough to know it had an alpha channel.Husted
N
14

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!

Noncommittal answered 22/3, 2017 at 12:35 Comment(1)
After creating a new .png file, I hit ctrl-a then delete, which made everything transparent. Then I pasted in the part of the source PNG that I wanted, and got the desired result. Thanks for this.Fonsie
P
3

In the VS 2013 image editor, the following works for me:

Select View-Toolbars-Image Editor so that you can see the toolbar

Select the eraser from the toolbar. Set the erase width in the property window to 1

Now clicking ("erasing") a pixel will set it to transparent

Pritchard answered 4/1, 2014 at 4:15 Comment(0)
C
2

The VS eraser tool was working but taking way too long for my image. This tool automatically made my white background transparent when I uploaded the png version.

https://www.bonanza.com/background_burner

  1. Drag and Drop image on page (then the page does some processing to the image)
  2. Click green download button on bottom right and select .png (transparent background)

Pros:

  • Free
  • Super fast
  • Online tool so nothing to download

Con:

  • Image needs to be at least 100 x 100px

I'm just using it for an intranet web app so I didn't need to put much time in or make it great quality.

Construction answered 28/5, 2015 at 15:44 Comment(1)
That site didn't work well for me but this one did beautifully! www168.lunapic.com/editorNewsman
C
0

In the VS2019 image editor you can also use the "M" key on the keyboard to select an area of an image based on color, and then use the delete key.

Competition answered 9/4, 2020 at 22:11 Comment(0)
A
0

If you have access to Microsoft Visio you can Import/Create the graphic object that you want to have some transparent pixels, make some or no changes to it and then Save As Type .png file.

After you hit Save As a PNG Output Options pop-up appears.

It gives you a Tick box to select the Transparency color (ie color you want to make transparent).

Aeschylus answered 4/6, 2020 at 7:14 Comment(0)
C
0

If you want a transparent image for a button you can just use an image with a white background.

e.g. for a resource named Filter.bmp on a button called Button_Filter

Dim bp As Drawing.Bitmap = My.Resources.Resources.Filter
bp.MakeTransparent(Color.White)
Button_Filter.Image = bp
Button_Filter.ImageAlign = ContentAlignment.MiddleCenter
Ctesiphon answered 31/10, 2023 at 0:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.