I have this jpeg image (abc.jpg) and I change some pixel values of this image and store this on hard disk, to later see the changed the pixel values. The name of the output jpeg image is say, xyz.jpg. The problem here is in the image xyz.jpg. The changed pixels does not give me the exact values which I changed them to.
In abc.jpg at the pixel position (x,y)=(1,10) the pixel value is (231, 120, 120). Now, I want to change it to (230, 120, 120). Now, I save this output image as xyz.jpg. When I try to retrieve the values from position (1,10) I get the pixel value as (232, 120, 120). Now you see the problem, I can't get the value to which I have changed. I am doing all this in MATLAB. And yes, I have tried to save the output image as .tiff, .bmp, .gif. But the size of these formats is very large as compared to .jpg. Please suggest some solution to this problem.