VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



very simple code to convert a picturebox picture into negative or convert a negative picture to col

by Greg S. (1 Submission)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 11th February 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

very simple code to convert a picturebox picture into negative or convert a negative picture to color.

Rate very simple code to convert a picturebox picture into negative or convert a negative picture to col




For i = 0 To Picture1.ScaleHeight - 1
For j = 0 To Picture1.ScaleWidth - 1

'pulling out values of RGB
            pixel = Picture1.Point(j, i)
red = pixel& Mod 256
           green = ((pixel And &HFF00) / 256&) Mod 256&
             blue = (pixel And &HFF0000) / 65536

'flipping colors to the other side of the color range
                '(essientally if it is 
'20% of the 255 range it becomes 80%, if it is 30% of the 255
  'range it becomes 70%.  The midpoint is around 128)

red = 255 * (1 - red / 255)
            green = 255 * (1 - green / 255)
blue = 255 * (1 - blue / 255)
            Picture1.PSet (j, i), RGB(red, green, blue)
Next
Next



Download this snippet    Add to My Saved Code

very simple code to convert a picturebox picture into negative or convert a negative picture to col Comments

No comments have been posted about very simple code to convert a picturebox picture into negative or convert a negative picture to col. Why not be the first to post a comment about very simple code to convert a picturebox picture into negative or convert a negative picture to col.

Post your comment

Subject:
Message:
0/1000 characters