How to use imwrite to save imshow(image01, [ ]) as a PNG file ?

27 次查看(过去 30 天)
So, I have an image file: image01.
When I use imshow to show the image, it will look different when I use limit: imshow(image01, [ ]).
When I use imwrite to write the image into a png file: imwrite(image01, "image01.png", "png"), the png file saved is the one when I dont use limit: imshow(image01).
I want to write the image shown when I use " imshow(image01, [ ]) "
Is it possible to do that using imwrite ? or do I have to use other method ?

回答(1 个)

Ameer Hamza
Ameer Hamza 2020-10-11
First rescale the image before saving it
img_new = rescale(image01, 0, 1);
imwrite(img_new, "image01.png", "png")

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by