Hi i have a problem executing a loop to change the brightness of an image

i have all the colour pixels and everytime the trackerbar moves it will decrease the pixels by 1 - i need to do this from 0 to 255 and vice a versa

can anyone help?