Pleinpopossum
asked on
Testing the pixels of a BMP in memory
My app reads a BMP file from the Hard drive and has to test the color of each pixel. I used to read byte after byte from the bmp file but the result is very very slow. I think I should load the bmp into the memory and test the pixels in it but how to load the file quickly enough and how to access to the properties of each pixel ? Thanks for your help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Also this one
' #VBIDEUtils#************** ********** ********** ********** ********** ******
' * Programmer Name : Waty Thierry
' * Web Site : www.geocities.com/ResearchTriangle/6311/
' * E-Mail : waty.thierry@usa.net
' * Date : 26/04/99
' * Time : 11:07
' ************************** ********** ********** ********** ********** ****
' * Comments : Change color of a pixel in a picturebox
' *
' *
' ************************** ********** ********** ********** ********** ****
Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Longg
' Place this code in Picture1_MouseDown(Button As...)
' This will replace the pixel at x:10, y:10 with a red pixel.
Dim s As Long
s = setpixel(Picture1.hDC, 10, 10, rgb(255,0,0))
Picture1.Refresh
' #VBIDEUtils#**************
' * Programmer Name : Waty Thierry
' * Web Site : www.geocities.com/ResearchTriangle/6311/
' * E-Mail : waty.thierry@usa.net
' * Date : 26/04/99
' * Time : 11:07
' **************************
' * Comments : Change color of a pixel in a picturebox
' *
' *
' **************************
Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Longg
' Place this code in Picture1_MouseDown(Button As...)
' This will replace the pixel at x:10, y:10 with a red pixel.
Dim s As Long
s = setpixel(Picture1.hDC, 10, 10, rgb(255,0,0))
Picture1.Refresh
Finally, an article :
http://www.advantage.co.nz/ur/imagepro2.htm
http://www.advantage.co.nz/ur/imagepro2.htm
ASKER
Thanks a lot ! I'll do my best to apply these new knowleges.
Hope to be able to help you anyday...
Hope to be able to help you anyday...
ReDim ByteArray(10)
Open filename For Binary As #1
Get #1, , ByteArray()
Close #1
This will read 11 bytes (if you have 0-based arrays (default)).