cool! thanks, I tested the get/setpixels and indeed it was way too slow... Thanks for the help!!
Martijn ----- Original Message ----- From: "s�b" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, July 03, 2002 11:32 AM Subject: <lingo-l> RE: <lingo-l>convert to greyscale with lingo > > Hi Martijn, > > > I'd like to convert a rgb bitmap to greyscale with lingo. How can it be > > done? > > I suppose I can use imaging lingo to adjust the (R,G,B). > > will this work?: > > > (... getPixel code...) > > > > Syntax may be off a little, but will it work by just take the > > average of R, > > G and B. Then assign the average value to the three channels? > > Using the get/stpixel methods for a whole image will be slooooOOOwww! > > here comes a little routine that should fit your needs: > > on ConvertToGrayscale (iSrcImage) ------------------------------------ > -- INPUT : iSrcImage <#image> : the image object you want to convert > -- OUTPUT: <#image> or VOID (if iSrcImage is not an image object) > ------- > > -- 1 - check input > if (ilk(iSrcImage) <> #image) then return VOID > > rImgRect = iSrcImage.rect > iBuffer = image(rImgRect.width, rImgRect.height, 8, #grayScale) > iBuffer.copyPixels(iSrcImage, rImgRect, rImgRect) > > return iBuffer > end -- ConvertToGrayscale handler > > -- sample use: > -- mSrcMember = member(1) > -- mGrayMember = new(#bitmap) > -- mGrayMember.image = ConvertToGrayscale(mSrcMember.image) > > hth, > .s�b > > [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!] ------------------------- Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl [EMAIL PROTECTED] ------------------------- [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
