.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Convert Bitmap to Image with transparency

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :Windows Application

I like to export the Bitmap directly to a Image without saving it.
How can i do that, if i save the image i get a correct png image.
But if i convert it on the way below, i get a black color on the transparancy part.
How can i solve this?

                                    Bitmap bm = new Bitmap(thumbnailImage);                                    
                                    //bm.Save(@"C:\temp\bw.png", System.Drawing.Imaging.ImageFormat.Png);

                                    thumbnailImage = (System.Drawing.Image)bm;

View Complete Post

More Related Resource Links

How convert bitmap to Image.source ?

I hold some bitmap object in the memory  ( simple System.Drawing.Bitmap ). I want to make some wpf image control to show this bitmap. I dont want to save the bitmap to the disk and then load it as URI to the wpf image control So, How can i do this simple action ?   Thanks.

How to Convert HTML to Image


 HI all,

I was struggling for the process/code to convert html to image. Please suggest any tutorials for this. And also any code help greatly appreciated.


thanks and regards,



Bitmap to Image Control - ImageUrl


 This is my first attempt at using the drawing features of asp.net.  I just want to start simple, and create a single color bar based on a value for a single graph.  I wrote this so far, but I can't figure out how to take the bitmap I just created, and apply it to the Image Control. Do I have to save the file first, and then reload it.

Plus, my box keeps coming out pure black, I trying to fill the box with a color. 

This is part of a web custom control, in which I dynamically created an Image Control. I want to apply the bitmap I made to the image control. 


Dim imgGoogle As Image
imgGoogle = New Image
imgGoogle.ImageAlign = ImageAlign.AbsMiddle
imgGoogle.ImageUrl = cs.GetWebResourceUrl(rsType, "ice5software.BotCatcher.Google.gif")
Private Sub DrawBarGraph_Google(ByVal BarValue As Integer)

	Dim objBitmap As System.Drawing.Bitmap
	Dim objGraphics As S

Displaying a System.Drawing.Bitmap in a WPF Image control

How would I convert a System.Drawing.Btimap into a comparable WPF image control so I can display in on my WPF window? Thanks

How to convert both text and image into image

Hi, Here is a question. how to convert both text and image together into an image. To clarify my question I can say if I have a text editor where I can add both text,image,audio or video player, how can I convert the whole texteditor.text (it gives me html code) to an image and save it in a file. I will be highly pleased with your answer. Help me please. Thank you. 

How to convert raster Image to Vector image format

I want to covert raster image to vector image format in  C#is it possible ??Thanks

How to determine the transparency color in a Bitmap

I think I found out how to set the transparent color in a bitmap. Bitmap.MakeTransparent(Color) But how can I get the transparent color from a bitmap. BTW. I read the term "Alpha Transparency" I'm guessing that that means the alpha values of the pixel colors are not all 255. Is that correct and is that all there is to it? Are there two features in a bitmap? The transparent color and Alpha Transparency. Or are they the same? Thanks in advance  

convert image to rtf code

how can i convert image to rtf code

Interesting Problem WPF Visual to Image Convert.


I am converting the Canvas to Image By using

renderBitmap = new RenderTargetBitmap(desiredWidth, desiredHeight, 96d, 96d, PixelFormats.Pbgra32);// PixelFormats.Pbgra32);
                    //RenderOptions.SetEdgeMode(drawingVisual, EdgeMode.Aliased);
                    RenderOptions.SetBitmapScalingMode(drawingVisual, BitmapScalingMode.HighQuality );
                    drawingVisual.SnapsToDevicePixels = true;
                    var dv = new DrawingVisual();
                    using (DrawingContext ctx = dv.RenderOpen())

                        var vb = new VisualBrush(drawingVisual);

How to Convert System.Drawing.Image Variable to Byte variable



I got a variable of type System.Drawing.Image and need to convert it to a variable of type byte so I can store the image in the database. Can someone show me how to do that in VB.NET code.

Thanks alot

Convert Image to PDFusing C#



I need to convert IMAGE to PDF, I have used ITextSharp, PdfSharp and PdfVision but the output PDF is not full image, either cutted or 20% of the image is converted....

Waiting for kind response...



showing a bitmap in an image...




Can someone please explain to me why the following code doesn't work (picture isn't shown):



  BitmapImage src = new BitmapImage();


  src.UriSource = new Uri("picture.jpg", UriKind.RelativeOrAbsolute);


  image1.Source = src;



...but works when the following lines are added:




  BitmapImage src = new BitmapImage();


  src.UriSource = new Uri("picture.jpg", UriKind.RelativeOrAbsolute);



  TransformedBitmap tb = new TransformedBitmap();


  tb.Source = src;


  image1.Source = src;



The Confused Beginner

Convert a control as an metafile image


I am having a problem when converting the control to a metafile image and adding the metafile in the print preview document. Print preview document appears fine but when zoomed, I could see some strokes appearing in the print preview document while drawing the controls. Is there any way to avoid this? Please suggest.




I have created a simple sample application. Please refer the following application and also the screen shot. Is this a bug?



How to convert Table to Image



I want to conver a html table and its content to an image with the best quality, I have read some post that use url while I need direct way to do this. For example when I press the button a table in the same page convert to image and save in local machine. I run this application in win XP Prof


How to convert image class object to byte type in order to insert database


I am trying to resize images after uploading and than inserting them into my database.

Dim newMainImage As System.IO.Stream = System.IO.Stream.Null
resizedMainImage.Save(newMainImage, jgpEncoder, myEncoderParameters)
Dim newMain As Image = Image.FromStream(newMainImage)

I was able to resize it however I couldnt find a way to convert image object to byte() in order to

I need something like

Dim ImageContent(newMain.ContentLength - 1) As Byte

newMain.InputStream.Read(ImageContent, 0 , newMain.ContentLength)

I need to convert image object to a file type in order to get its contentlenght and use .inputStream.Read function. Or is there any other way?

How to convert .tiff image file to .pdf file without using any 3rd party tool using C#.net


HI all

I have a urgent requirement i want to convert .tiff image to .pdf file 

Thanks in advance

"Smushed" pixels / fuzzy image (even with bitmap class or nearestneighbor)


hi all--

we're having myriad problems with artifacts and other video issues, on three separate computers and three different video cards (2 ATI, 1 NVIDIA).

one of the main issues we're having is that there are certain times when pixels in an image turn fuzzy, even with RenderOptions.BitmapScalingMode="NearestNeighbor" and/or RenderOptions.EdgeMode="Aliased" and/or using the Bitmap class. i've also tried combinations of snapstodevicepixels and uselayoutrounding. 


  • the first picture (a screenshot, enlarged) shows what it (an image in a scatterviewitem, surface touch beta for win7) looks like with BitmapScalingMode set to HighQuality -- as expected, it's fuzzy

  • the second picture (also a screenshot) shows what it looks like when set to NearestNeighbor. looks great, right?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend