Why can I not open a JPEG image written using lossless compression outside of MATLAB?

12 views (last 30 days)
I am writing to an image file using the IMWRITE function. I have specified the mode to be 'lossless'. The image file is not viewable outside of MATLAB. I have tried a number of different viewers. I can read the image back into MATLAB and display it. If I specify the mode to be 'lossy', the image is viewable outside MATLAB.
I am using the following code to create the image:
x = rand(100,100);
imwrite(x,'test.jpg','mode','lossless');

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 25 Mar 2020
Edited: MathWorks Support Team on 24 Mar 2020
The lossless JPEG format is not a popular format and is not supported by most common applications including Microsoft applications. The more popular JPEG format is lossy.
Lossless JPEG should not be confused with JPEG-LS a new standard which uses lossless compression. MATLAB does not support JPEG-LS.
PNG is a common lossless compression format. The following code writes an image to PNG format:
x = rand(100,100);
imwrite(x,'test.png');

More Answers (0)

Tags

No tags entered yet.

Products

Community Treasure Hunt

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

Start Hunting!