473,405 Members | 2,176 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

System.Drawing.Bitmap alpha

I'm using the System.Drawing.Bitmap class for loading a 32-bit bmp file which
includes an alpha channel.

The problem is, when it gets loaded (just using the Bitmap(string filename)
constructor), it doesn't bother bringing the alpha along with it. All of the
pixels just show "255" as their alpha value and Bitmap.IsAlphaPixelFormat()
returns false.

I know that the alpha does exist physically and has worked with this exact
image in other contexts. So, does anyone know how I can make Bitmap behave
and actually give me my alpha channel in the file? Thanks much.
Nov 16 '05 #1
3 17330
..png Bitmaps use the alpha channel

I encountered no problems using them in my projects.

Erik
"instruo" <in*****@discussions.microsoft.com> schrieb im Newsbeitrag
news:90**********************************@microsof t.com...
I'm using the System.Drawing.Bitmap class for loading a 32-bit bmp file which includes an alpha channel.

The problem is, when it gets loaded (just using the Bitmap(string filename) constructor), it doesn't bother bringing the alpha along with it. All of the pixels just show "255" as their alpha value and Bitmap.IsAlphaPixelFormat() returns false.

I know that the alpha does exist physically and has worked with this exact
image in other contexts. So, does anyone know how I can make Bitmap behave
and actually give me my alpha channel in the file? Thanks much.

Nov 16 '05 #2
Hi,

Try posting this in the framework.drawing NG as Bob Powell is the resident
master on all things in the Drawing namespace.

Steve

"instruo" <in*****@discussions.microsoft.com> wrote in message
news:90**********************************@microsof t.com...
I'm using the System.Drawing.Bitmap class for loading a 32-bit bmp file
which
includes an alpha channel.

The problem is, when it gets loaded (just using the Bitmap(string
filename)
constructor), it doesn't bother bringing the alpha along with it. All of
the
pixels just show "255" as their alpha value and
Bitmap.IsAlphaPixelFormat()
returns false.

I know that the alpha does exist physically and has worked with this exact
image in other contexts. So, does anyone know how I can make Bitmap behave
and actually give me my alpha channel in the file? Thanks much.

Nov 16 '05 #3
Basicly, a new Bitmap object is 24BPP which is why you lose the Alpha
content.
Draw the bitmap directly to a controls graphics object and you should have
no problems with Alpha, but when you manipulate the bitmap in a Memory
Bitmap the Alpha is lost. What you must do to overcome this issue, is create
the memory bitmap via a BitmapData object.

Whilst the example at the following link is for a 32bit Icon, it will give
you the solution to your problem.
http://dotnetrix.co.uk/misc.html --> Get Alpha Bitmap from 32 bit Icon.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"instruo" <in*****@discussions.microsoft.com> wrote in message
news:90**********************************@microsof t.com...
I'm using the System.Drawing.Bitmap class for loading a 32-bit bmp file
which
includes an alpha channel.

The problem is, when it gets loaded (just using the Bitmap(string
filename)
constructor), it doesn't bother bringing the alpha along with it. All of
the
pixels just show "255" as their alpha value and
Bitmap.IsAlphaPixelFormat()
returns false.

I know that the alpha does exist physically and has worked with this exact
image in other contexts. So, does anyone know how I can make Bitmap behave
and actually give me my alpha channel in the file? Thanks much.

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: news.microsoft.com | last post by:
Hello group, My goal is to attach an image over another image. Top image should be transparent so the back image is visible through the top one. Bellow is a test code in VB.NET. You need to...
0
by: Tomi Holger Engdahl | last post by:
I am looking for a solution to add on-line drawing tool to a phpBB discussion board. The idea would be that the users can draw their own simple drawings with the tool and attach them easily as...
1
by: Hadar | last post by:
Hi, I'm getting "object is currently in use elsewhere" when I use System.Drawing.Graphics.MesureString. This is what I do: My controls use a utility class the helps it to mesure strings. To...
0
by: John via .NET 247 | last post by:
Hi, I'm using the System.Drawing.Bitmap namespace to load an image,and the RotateNoneFlipY method to flip that image before saving.However I have noticed that the saved image appears cropped...
3
by: Qwert | last post by:
Hello, I want to draw from one System.Drawing.Bitmap to another. All I can find is how to draw to a Graphics object. System.Drawing, System.Drawing.Drawing2D or System.Drawing.Imaging have no...
7
by: Fir5tSight | last post by:
Hi All, I used the following code in C#: using System.Drawing; //blah blah blah Bitmap bmp = new Bitmap();
3
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
2
by: ThatsIT.net.au | last post by:
I have this code that writes a pie chart in a asp.net page, but I want to use it in a server control. When I try I get a error on the last line "Response.OutputStream" Obviously there is no...
2
by: Nathan Sokalski | last post by:
I am attempting to create icons for controls I have created using VB.NET by using the System.Drawing.ToolboxBitmap attribute. I have managed to do this in C# by specifying the path to the *.ico...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.