On 1/21/07, Balaganesh Damodaran <[EMAIL PROTECTED]> wrote:
> Er... I'm a total dunce when it somes to javascript so i'd appreciate a
> bit more detailed explanation of what exactly im supposed to do with the
> function...
> regards,
> bg
> Aron Rubin wrote:
>
> >// luminosity value from color components
> >function rgb2lum( r, g, b ) {
> > return( (0.299/255.0)*r + (0.587/255.0)*g + (0.114/255.0)*b );
> >}
> >
> >On 1/19/07, Balaganesh Damodaran <[EMAIL PROTECTED]> wrote:
> >
> >
> >>Hi guys,
> >> I need to force firefox into displaying any image on any page in
> >>greyscale. Is there any way to do this???
> >>Regards,
> >>bg
> >>
The only way I know to do this would be to use the canvas image
element. I don't think you can access the pixel data from the w3c DOM.
You would use getImageData() to get the pixels (image data). For each
pixel get the luminance (with the supplied function and then set each
color channel to the luminance. Then you would use setImageData() to
write the pixels back out.
http://www.whatwg.org/specs/web-apps/current-work/#getimagedata
Aron
_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners