How to convert the image with the following information: ColorType: truecolor Format: png bitDepth: 24
to a png grayscale image with bitdepth=8 in matlab ?
From the documentation for imwrite
For color images, the BitDepth value is the number of bits per plane
You ask matlab to write 3 colour channels with 8 bits each, which results in 24 bits. If you want grayscale, use rgb2gray
first to convert to grayscale, then write.