I have a PNG image processing workflow that relies on the images to be in the 24bit Truecolor format also known as RGB images. PNG permits either RGB or Indexed color representation.
pnmtopng program from NetPBM automatically decides which type of image to write depending on the number of distinct colors in the image. I recall reading somewhere that if this number is 256 or fewer, it automatically writes an Indexed image.
Is there a way to preserve the type of the image?
For instance if I am using NetPBM to flip an image as follows
pngtopnm true-color-image.png | pamflip -tb | pnmtopng > new-image.png
Is there a way to ensure that new-image will also be a Truecolor image?
At the moment I can check that the image is of a wrong type, because its size is about 50% less than that of the original image.
37155 true-color-image.png 27463 new-image.png
I expect the new image to be about the same size as the original.
identify from ImageMagick gives the following for these two images:
true-color-image.png PNG 300x280 300x280+0+0 8-bit sRGB 37155B new-image.png PNG 300x280 300x280+0+0 8-bit sRGB 61c 27463B