Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Remove all non black pixels from image
Message
From
26/12/2013 14:45:29
 
 
To
26/12/2013 11:51:41
Emerson Reed
Folhamatic Tecnologia Em Sistemas
Americana - São Paulo, Brazil
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01590997
Message ID:
01591001
Views:
79
This message has been marked as a message which has helped to the initial question of the thread.
>Hi folks!
>Using GDIPlusX, how to remove all non black pixels from an image?


If you capture the data to a 32-bit bitmap, you can read the bitmap buffer data and look for all CHR(0)+CHR(0)+CHR(0) combinations at either the start or end of the 4-byte block (depending on endian, a small test would indicate which it is) references which occur on 4-byte boundaries:
lcBlack = CHR(0)+CHR(0)+CHR(0)
FOR lnI = 1 TO bufferLength STEP 4
    IF SUBSTR(buffer, lnI, 3) == lcBlack OR SUBSTR(buffer, lnI + 1, 3) == lcBlack
        * It's a black pixel
    ENDIF
NEXT
You could also capture the bitmap, invert its colors, use VFP to overlay the inverted image atop a known background color with the Image's mode set to TRANSPARENT (where all WHITE pixels are ignored), then capture that image and save it to another buffer. Then, repeat the same process using another background color. In such a case, every difference between the two images will be where the black pixels were.
Previous
Reply
Map
View

Click here to load this message in the networking platform