- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsIn my program I have a statement to get the colour of a pixel as follow:
Color pixelColor = myBitmap.GetPixel(pixelXY.
When I display value of the selected pixel using:
label1.Text = pixelColor.ToString();
I notice the value is different from the actual RGB value.
For example,
RGB value for violet is
[238, 130, 238]
but the value display in label1 is
[221, 160, 221]
May I know how to get the correct RGB value of a pixel?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: topdog770Posted on 2008-04-16 at 06:59:04ID: 21367788
Generally speaking, the format of a bitmap can effect the rgb values of the pixel in it.
port/DocVi ewer/2/ Alp haChannel. htm.aspx ) ========== ========== ========== ========== ========== ==
x,
As one example, a bitmap using an alpha channel can cause the expected RGB values to be different then what is expected since the pixel color is the result of a calculation of the pixel's color and it's alpha value.
Some information about the Alpha channel ( from http://www.aurigma.com/Sup
==========================
Pixels of image can store information about their opacity along with color. It allows to create images with transparent or semi-transparent areas. It is very useful when you create such imagery as non-rectangle logos or watermarks which you will put on another images. There are two ways to specify transparency of a pixel - alpha channel and color key .
Color Keys
Color key is a color which is treated as transparent during displaying or blending. This technique is widely used in DirectX programming, however Graphics Mill almost does not use it (it uses alpha blending instead). It is used only when Graphics Mill saves indexed image into format which supports transparency only in color key mode (such as GIF).
The main disadvantage of this method is that it cannot save semitransparency. That's why colorkeying cannot produce smooth blend between edge of opaque and transparent area. That's why Graphics Mill use another method: alpha blending.
Alpha Channel
Instead of appointing some color to be transparent, each pixel stores information how much does it opaque. This information is called alpha channel and stored along color channels. The most wide-spreaded alpha-compliant pixel format is Format32bppArgb. Each channel (including alpha channel) occupies one byte. When alpha = 255 (max value work this pixel format), the color is treated as fully opaque, when alpha = 0, the color is fully transparent (during blending background color is not changed). For alpha values between 0 and 255, color is treated as semi-transparent and during blending each channel of the result color is calculated using the following formula:
result = (foreground*alpha + background*(max-alpha))/ma
where max = 255 for this pixel format.
Select allOpen in new window