By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,280 Members | 1,232 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,280 IT Pros & Developers. It's quick & easy.

Grayscale ColorMatrix Difference

P: n/a
Hi I was at the search for making e.Graphics.DrawImage turn any image
to Grayscale, and I found two similar solutions but different
ColorMatrix values, what is the difference between the two? Is there
an industry standard for the GrayScale ColorMatrix values?

Thanks,
Henry

Solution #1, Jacob Grass:

http://groups.google.com.ph/groups?h...sftngp05#link3

Dim GrayShear()() As Single = New Single()() _
{New Single(4) {0.5, 0.5, 0.5, 0, 0}, _
New Single(4) {0.5, 0.5, 0.5, 0, 0}, _
New Single(4) {0.5, 0.5, 0.5, 0, 0}, _
New Single(4) {0, 0, 0, 1, 0}, _
New Single(4) {0, 0, 0, 0, 1}}
Solution #2, Bob Powell:

http://groups.google.com.ph/groups?h....phx.gbl#link4

Dim cm As ColorMatrix = New ColorMatrix(New Single()() _
{New Single() {0.3, 0.3, 0.3, 0, 0}, _
New Single() {0.59, 0.59, 0.59, 0, 0}, _
New Single() {0.11, 0.11, 0.11, 0, 0}, _
New Single() {0, 0, 0, 1, 0}, _
New Single() {0, 0, 0, 0, 1}})
These are just portions of the code, I just copied and pasted the
Grayscale ColorMatrix values and they differ from one another.
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Use the one from Bob to get the true grayscale.

"Henry Wu" <he***********@hotmail.com> wrote in message
news:86*************************@posting.google.co m...
Hi I was at the search for making e.Graphics.DrawImage turn any image
to Grayscale, and I found two similar solutions but different
ColorMatrix values, what is the difference between the two? Is there
an industry standard for the GrayScale ColorMatrix values?

Thanks,
Henry

Solution #1, Jacob Grass:

http://groups.google.com.ph/groups?h...sftngp05#link3

Dim GrayShear()() As Single = New Single()() _
{New Single(4) {0.5, 0.5, 0.5, 0, 0}, _
New Single(4) {0.5, 0.5, 0.5, 0, 0}, _
New Single(4) {0.5, 0.5, 0.5, 0, 0}, _
New Single(4) {0, 0, 0, 1, 0}, _
New Single(4) {0, 0, 0, 0, 1}}
Solution #2, Bob Powell:

http://groups.google.com.ph/groups?h....phx.gbl#link4

Dim cm As ColorMatrix = New ColorMatrix(New Single()() _
{New Single() {0.3, 0.3, 0.3, 0, 0}, _
New Single() {0.59, 0.59, 0.59, 0, 0}, _
New Single() {0.11, 0.11, 0.11, 0, 0}, _
New Single() {0, 0, 0, 1, 0}, _
New Single() {0, 0, 0, 0, 1}})
These are just portions of the code, I just copied and pasted the
Grayscale ColorMatrix values and they differ from one another.

Nov 21 '05 #2

P: n/a
Thanks again Dr. ScrewUp,

I finally got the Magnifier working the way I want it.
http://wuhenry.beigetower.org/MagnifierXP-Final.zip

You remember the seperate repaint function you made, that did the
trick for it to not flicker, even when I remove the mouse monitoring
variables, it does not flicker at all. As long as I don't call any
Invalidate :)

Thanks so much,
Henry
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.