Saturday, December 12, 2009

How to detect if bitmap is grayscale ?!

SA :)
Here we're again talking about images, it's all about image processing course :D
well I needed my package to do a specific action depending on whether the image is colored or grayscale.
So, how to achieve this ?!
I searched a lot but I reached nothing :S
so I had to loop the pixels of the image and make sure that the RGB components of each pixel are equal to detect it as grayscale.
How bad !!
But finally I discovered another simple method ;)
consider you have a Bitmap object called Myimage.
the condition of grayscale is( Myimage.Palette.Flags = = 2)
so if this condition is true Myimage is grayscale, else it's colored :D
Yes..That easy ;)
Enjoy it ;) :D

7 comments:

Ahd Abd El-Razek said...

nice post & nice blog
go on (Y);)

Rehab Reda said...

nice :)

Fatma Samy said...

Thnx girls ;) :D

Unknown said...

البوست دي تضحك أوي بجد :]

Fatma Samy said...

:D:D:D:D:D
اشمعنا يعنى :D
عشان بتبين معاناتى فى ال
package
يعنى !! :D

Unknown said...

لأ أصل مخدتش بالي ان البوست قصيرة
و كنت متخيل الحل ألجورزم رهيب مثلا :]
لقيت الحل سطر واحد فا ضحكت جامد :]

Fatma Samy said...

:D :D :D lol
هى دى التكنولوجيا بقى (H)

Post a Comment