MATLAB: How can save an image without matlab altering any of the images’s property

axesdata exportImage Processing Toolboxpixel valuesave image

I need to save an image i displayed in an axes, am doing so currently with the 'getimage' function. But it seems to be changing the image pixel values when i save, is there another function i can use that doesn't alter the image in any way?

Best Answer

You only get changed pixel values if you save the image with a lossy compression format like JPEG. To avoid that, save the image in a format that does not use lossy compression. For example, use PNG (which uses lossless compression) and a call to imwrite():
imwrite(rgbImage, 'myImage.png');
However that will not save any EXIF or IPTC metadata that was stored along with your original image file, nor will it preserve the file date.