 |
|
 |
Takeshi Level: Protégé
 Registered: 08-09-2008 Posts: 8
|
Re: Get RGB
Thakns... One question again. I was make a code to insert that RGB values to an array, but an error appear "subscript out of range". Can u help me ?
I make this code before i receive your message. I try to use getpixel anyway, but still not sure i get the color because that error message :
Private Sub Command2_Click()
Dim intX As Integer
Dim intY As Integer
Dim n As Integer
Dim M As Integer
Dim a() As Integer
Dim b() As Integer
Dim C() As Integer
Dim col As Long
Dim RGB() As Byte
Dim i As Integer
n = 0
M = 0
With Picture1.Picture
intY = ScaleY(.Height, vbHimetric, vbPixels)
intX = ScaleX(.Width, vbHimetric, vbPixels)
Me.Label13 = "height : " & intY & ", Width : " & intX
i = 0
For n = 0 To intX
For M = 0 To intY
col = GetPixel(Picture1.hDC, n, M)
a(i) = col And &HFF ('this line is error')
'b = (col \ 256) Mod 256
b(i) = (col \ &H100) And &HFF
'c = (col \ 256 \ 256)
C(i) = (col \ &H10000) And &HFF
i = i + 1
M = M + 1
Next
n = n + 1
Next
End With
End Sub
Thanks for your help. GBU.
[Edited by admin on 12-11-2008 at 02:53 PM GMT]
|
|
11-11-2008 at 09:29 AM |
|
|
Takeshi Level: Protégé
 Registered: 08-09-2008 Posts: 8
|
Re: Get RGB
It's not work, instead appear an another error 'overflow' at redim statement.
|
|
16-11-2008 at 04:13 PM |
|
|
Takeshi Level: Protégé
 Registered: 08-09-2008 Posts: 8
|
Re: Get RGB
FinaIly, i have found the answer of that error. I change data type of intX or intY to long type. Can one or both. I don't know why must like that (if u can explain me, i so thanks u ).
So, next.
If i change the value of all array of RGB values, then i want to save again / create the changed RGB values to an image file (bmp, jpg, gif, etc), what should i do ? Or ,what codes i must write ?
I wait for your answer. Thanks. GBU.
|
|
16-11-2008 at 06:34 PM |
|
|
|
|
 |
 |