# Multiplying Intensity Image Subtraction

So I am creating an intensity image as follows:

```
void convertToGrayImg(Mat& img, Mat& result) {
Mat gray_img;
cvtColor(img, gray_img, CV_BGR2GRAY);
result = gray_img;
}
```

Now I have to multiply the intensity image I by 0.5 and subtract it from each color channel. How can this be done?

I am confused, do I multiply every pixel with 0.5 or is there a function to do the same? I am very new to OpenCV.

Thanks.