How can save an image without matlab altering any of the images's property

10 ビュー (過去 30 日間)
Gaffar kasumu
Gaffar kasumu 2016 年 6 月 12 日
回答済み: Walter Roberson 2016 年 6 月 13 日
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?

採用された回答

Image Analyst
Image Analyst 2016 年 6 月 12 日
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.

その他の回答 (2 件)

Stalin Samuel
Stalin Samuel 2016 年 6 月 12 日
  • Read the image using imread
  • ex. I=imread('test.jpg');
  • Now the image pixel values available in the variable I
  • Otherwise you can permanently store the image in the directory as mat file
  • To save as mat file use 'save I'
  • Then later whenever the image is required use 'load I ' to load the image into workspace

Walter Roberson
Walter Roberson 2016 年 6 月 13 日
If you are creating a pseudocolor image and want to save it, then I recommend you look in the File Exchange for the freezeColors contribution. You would call that and then you could get() the CData property of the image handle and the result would be an RGB image equivalent to the displayed pseudocolor image. You can then imwrite() that using a lossless format such as PNG or TIFF.

カテゴリ

Help Center および File ExchangeImport, Export, and Conversion についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by