Does IMWRITE support lossy compression for 16 bit data in MATLAB 7.4 (R2007a)?

I would like to know if I can use IMWRITE with 16 bit data to write images with lossy compression. When I run the code:
X = uint16(65535 * rand(1024,1024));
imwrite(X,'noise.jpg','jpeg','BitDepth',16,'Mode','lossy','Quality',75);
??? Error using ==> imagesci\private\writejpg at 61
Lossy compression not supported for 16 bit data.

 Accepted Answer

The JPEG standard does not allow lossy compression when working with 16-bit data. As a result, 16-bit lossy compression is not supported by IMWRITE.
To work around this issue, use 16-bit lossless compression or convert the data to 8-bit and then use 8-bit lossy compression with IMWRITE.

More Answers (0)

Products

Release

R2007a

Community Treasure Hunt

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

Start Hunting!