How can I detect transparent pixels in an image
using WPF so that I know where a user clicks?
Asked
Active
Viewed 485 times
0
-
i think most people's first question back to you is WHY do you need to detect transparent pixels? we probably would have a better answer about what you're trying to do than HOW you're trying to do it. What do you need to do with the transparent pixels? – John Gardner Aug 02 '10 at 18:04
-
WHY to detect where user click picture – in4man Aug 05 '10 at 18:48
1 Answers
0
U don't need Image class, it is not design for pixel manipulation. Rater use Bitmap* class
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.UriSource = new Uri(@"/test.png",UriKind.RelativeOrAbsolute);
bi.EndInit();
Implement public PixelColor[,] GetPixels(BitmapSource source) method and then interate through returned array to find Alpha channel ( a simple loop). Mind that some images does not support transparency and the file vary depends on structure (ARGB, RGBA) etc.

Community
- 1
- 1

Lukasz Madon
- 14,664
- 14
- 64
- 108
-
heu can you help me more - Bitmap* What class should i use? *Image not supported? – in4man Aug 05 '10 at 18:38