ok this is the deal.. i have a code to convert an image to a certain color. what i do is get the R G B values and then add a certain value to them. (like 120 to r to create a more red image)
but this code only works correctly with grayscale images what am i doing wrong?
VB Code:
Option Explicit Dim temp As Long Dim red As Integer Dim green As Integer Dim blue As Integer Dim color(2) As Integer Private Sub Command1_Click() Dim x As Long Dim y As Long Dim temphex As String red = rvalue: green = gvalue: blue = bvalue For y = 0 To Picture1.Width - 1 For x = 0 To Picture1.Width - 1 obtainRGB (Picture1.Point(x, y)) Picture1.PSet (x, y), RGB(color(0), color(1), color(2)) DoEvents Next x Next y End Sub Private Sub obtainRGB(cValue) color(0) = Int(cValue / 65536) + Int(red) cValue = cValue Mod 65536 color(1) = Int(cValue / 256) + Int(green) cValue = cValue Mod 256 color(2) = cValue + Int(blue) If color(0) < 0 Then color(0) = 0 If color(1) < 0 Then color(1) = 0 If color(2) < 0 Then color(2) = 0 End Sub




Reply With Quote