Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27441

Creating a transparent background in BMP or GIF images

$
0
0
I'm working on a program that creates images from AutoCAD drawings. I can create bmp images with a white background. However, I need to convert the images to gif, with a transparent background. I tried to use maketransparent from the bitmap class, but that does not work. I get a gif image with a black background. Any help would be greatly appreciated.
The bitmaps are 8 bit, 930 x 515 pixels. I have posted my code below:

Code:

Private Sub BmpToGif(ByVal fileName As String)

            Dim newFile As String

            'bitmap class in system.drawing.imaging
            Dim objBmp As New Bitmap(fileName & ".bmp")
            objBmp.MakeTransparent(Color.White)

            newFile = fileName

            newFile &= "." & ImageFormat.Gif.ToString
            objBmp.Save(newFile, ImageFormat.Gif)


        End Sub


Thanks
btm

Viewing all articles
Browse latest Browse all 27441

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>