Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Vesper103
16
Years of Service
User Offline
Joined: 21st Feb 2008
Location: Beloit WI
Posted: 28th Feb 2008 04:20
how do i make an image greyscale using memblocks?

the method i used i stored each pixel in a dword then extracted the red green and blue, then i re-wrote the dword to constant (r+g+b)/3 thinking that would get an average color but no go. it looked like it deleted every other pixel and made it all weird...

second question tho.

what is "alpha" ? sorry for what I know is the extreme noob nature of this equation.

Your signature has been erased by a mod - please limit your signature to 600x120
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 28th Feb 2008 04:50
Average the Red Green Blue for each pixel.. then set all three to that ..

however there is WIKI about how although this trick works - the human eye "Appreciates" it more when there is some weighting going on - meaning... just go read the WIKI LOL... something about lighter colors from ? to ? you should do it like blah... Mid Range ..like booo... then darker colors like blah....

Basically - it has recommendations to make contrasts the human eye naturally recognizes better than the "Averaging" method.

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 28th Feb 2008 12:31
The order of bytes in the DWORD is BGRA. So you need to

add bytes 1,2 and 3
divide by 3
Put the resulting value back in bytes 1,2, and 3, one byte at a time
leave byte 4 as it is.

The alpha is the level of transparency of the pixel.
Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 28th Feb 2008 13:40
The Wikipedia page on greyscale recommends 30% red, 59% green, and 11% blue for the output value.

Login to post a reply

Server time is: 2024-11-26 03:43:39
Your offset time is: 2024-11-26 03:43:39