[R] [help] reduce the bit depth of a png file

Vera Thiemig vera.thiemig at ext.jrc.ec.europa.eu
Wed Jan 21 15:28:09 CET 2015


Dear all,

 

I would like to reduce the bit depth of a png file from originally 24 to 8
(with the main intention to decrease the file size).

 

With the ordinary png(.) command it seems to be not possible. So, I created
first the png file and then re-wrote it with writePNG of the png package
(http://cran.r-project.org/web/packages/png/png.pdf) as it is written that:

 

"Currently writePNG only produces 8-bit, deflate-compressed, non-quantized,
non-interlaced images. Note in particular that readPNG can read 16-bit
channels but storing them back using writePNG will strip the 8 LSB
(irrelevant for display purposes but possibly relevant for use of PNG in
signalprocessing if the input is truly 16-bit wide)."

 

However, I end up with a 24-bit file again :(

 

Anybody has an idea of how to proceed?

 

Thank you,

 

Vera


	[[alternative HTML version deleted]]



More information about the R-help mailing list