October 18, 2018
Hot Topics:

# Image Negations

The Basic Principle of Making neagtive image from a normal one involves complimenting colors.The process of complementing involves representing colors in a three dimensional cube with the basic colors RGB as the three axis of the cube. When all colors are represented in a cube the opposite corners represent the Complement of the color.

Complement of white is black, complement of blue is yellow. Complementing can be done using the RGB combination.

white rgb(255,255,255)

The complement of white can be obtained by rgb(255-255,255-255,255-255) which has rgb(0,0,0) which is black.

The same concept as above is used in the program but just converted the integers to hexadecimal for the ease of calculation.

```For i = 0 To Picturebox.ScaleHeight - 1
For j = 0 To Picturebox.ScaleWidth - 1
pixvalue = Picturebox.Point(j, i)
hex_pixval = Hex(pixvalue)
red_val = "&h" & Mid\$(hex_pixval, 5, 2)
green_val = "&h" & Mid\$(hex_pixval, 3, 2)
blue_val = "&h" & Mid\$(hex_pixval, 1, 2)

If red_val = "&h" Then red_val = "&h0"
If green_val = "&h" Then green_val = "&h0"
If blue_val = "&h" Then blue_val = "&h0"

red_val = &HFF - red_val
green_val = &HFF - green_val
blue_val = &HFF - blue_val

Picturebox.PSet (j, i), RGB(red_val, green_val, blue_val)
Next
Next```

Comment and Contribute

(Maximum characters: 1200). You have characters left.

## Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.

## Most Popular Developer Stories

Thanks for your registration, follow us on our social networks to keep up-to-date