Why can I not open a JPEG image written using lossless compression outside of MATLAB?
12 views (last 30 days)
Show older comments
MathWorks Support Team
on 27 Jun 2009
Edited: MathWorks Support Team
on 24 Mar 2020
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
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');
0 Comments
More Answers (0)
See Also
Categories
Find more on Audio and Video Data 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!