How to determine if a pixel in a GIF is transparent (.NET)

How can I determine if a particular pixel in a GIF image is transparent in C#? I can see the MakeTransparent method in Bitmap, but nothing to determine if it is actually transparent already.

Thanks.

Answers


Use GetPixel and then look at the Alpha component of the Color instance returned. 0 = fully transparent.

If you need to loop through all (or many) pixels, be aware that GetPixel is quite slow. A faster, but more involved way, is to use LockBits to lock the data in memory, then look at the bitmap data directly.


Need Your Help

Form validation with javascript in coldfusion

javascript html forms coldfusion coldfusion-9

I am trying to validate two fields. One is open time and the other one is close time. My validation should check if the close time has a value anything else than "00" my open time should have a value

Alternatives to using web.config to store settings (for complex solutions)

asp.net web-config configuration-files

In our web applications, we seperate our Data Access Layers out into their own projects.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.