To save an image as PNG with lower bit depths in MATLAB, you can use the imwrite function. The imwrite function can take the following syntax:
main.m51 chars2 lines
where:
A is the image matrix to be savedfilename is the name of the PNG file to be saved'png' specifies the file format'BitDepth' specifies the desired bit depth of the saved image (8, 4 or 2 bit)bitdepth is an integer value indicating the bit depth.Here's an example of how to save an image as PNG with 4-bit depth:
main.m148 chars4 lines
This will save the original_image as a PNG file with 4-bit depth and the file will be named example_image_4bit.png.
gistlibby LogSnag