Save bitmap with BitDepth = 9

Hello,
I have a bitmap with the usual 24bit BitDepth. Which is 8bit x 8bit x 8bit colors.
Now I converted the colors to a total of 8 different colors, so I could create a bitmap with a colorrange from 0 to 3bit (or 7) (instead of the usual 8bit (or 255)) to compress the image.
But how do I save that new bitmap file with a different BitDepth?
I tried
Aq = uint8(reshape(Xq, size(A)));
imwrite(Aq, '3-bit-color-bitmap.bmp');
Where A is the original 383x600x3 uint8 bitmap and Xq is the edited one in 2D, which is reshaped back to a 3D array.
But my filesize stays the same, because it's probably still in the same old colorrange from 0-255.
I can't create an uint3 array with
Aq = uint3(reshape(Xq, size(A)));
imwrite(Aq, '3-bit-color-bitmap.bmp');
because uint3() does not work.
So how do I save the compressed bitmap with a different BitDepth?

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Color and Styling 的更多信息

提问:

2020-6-16

编辑:

2020-6-16

Community Treasure Hunt

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

Start Hunting!

Translated by