Why imwrite doesn't work??
Show older comments
I have a .mat file of Lena(greyscale) and i want to use imwrite to trnsfer it to a jpeg file. so i used:
load Lena;
imwrite (Lena, 'lena.jpg')
there is a jpeg file being generated but it is all white (all values are 255). I don't know why is that?
Answers (1)
Your image has double values on range [0,255], so you need to scale the values to [0,1] or change the class:
imwrite(uint8(Lena), 'lena.jpg')
imwrite(Lena/255, 'lena.jpg')
Categories
Find more on Denoising and Compression in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!