MATLAB how can I save an image?

autosave, matlab

Solution

Use the function `imwrite` to do that:

imwrite(image_matrix, 'myimage.bmp', 'bmp')

imwrite documentation on mathworks

Problem

I tried the commands: ``` imshow(originalImage); imsave; ``` it works, but I want the matlab to automatically save the image in bmp format (in the current folder). I tried to use: ``` save('myimage.bmp','originalImage'); ``` the picture was saved, but on the image itself, instead of the picture, I saw this message: "windows photo viewer can't open this picture because the file apears to be damaged, corrupted, or is too large". (the size of the picture is 5kb). Thanks!

Original source