>LOCAL oBmp AS xfcBitmap >LOCAL oBmpData AS xfcBitmapData > >DO System.app > >cOpenFile = GETPICT() >IF EMPTY(cOpenFile) > RETURN >ENDIF >cSaveFile = PUTFILE("Save","output.bmp","bmp") >IF EMPTY(cSaveFile) > RETURN >ENDIF > >WITH _SCREEN.System.Drawing > ** Open the file > oBmp = .Bitmap.FromFile(cOpenFile) > ** Lock the entire image bits > oRect = .Rectangle.New(0, 0, oBmp.Width, oBmp.Height) > oBmpData = oBMP.LockBits(oRect, ; > .Imaging.ImageLockMode.ReadWrite, ; > .Imaging.PixelFormat.Format24bppRGB) > > IF oBmpData.Scan0 << 0 > ** Calculate the memory size, there are 3 bytes per pixel (24bpp) > nBytes = oBmpData.Width * oBmpData.Height * 3 > nOffset = oBmpData.Scan0 > FOR nPos = 0 TO nBytes-1 STEP 3 > nR = ASC(SYS(2600, nOffset+nPos, 1)) > nG = ASC(SYS(2600, nOffset+nPos+1, 1)) > nB = ASC(SYS(2600, nOffset+nPos+2, 1)) > > IF MOD(nR+nG+nB,2)=1 && Pixel Sum is Odd, convert to White > SYS(2600, nOffset+nPos, 3, 0hFFFFFF) > ENDIF > > ** Progress: > IF MOD(nPos,300)=0 > WAIT WINDOW NOWAIT NOCLEAR ; > "Converting: "+ALLTRIM(STR(nPos*100/nBytes))+"%" > ENDIF > ENDFOR > ** Unlock the memory bits > oBmp.UnlockBits(oBmpData) > ** Save changes to a BMP file > oBmp.Save(cSaveFile, .Imaging.ImageFormat.Bmp) > WAIT CLEAR > ENDIF >ENDWITH > >RETURN >