[GEOT-4540] Force 8-bit palette before writing to PNG8

Patch for GEOT-4540.
Forces a paletted image to be 8-bit before encoding as PNG8.