png8 hextree/octree encoding produces blank output

Test case:
* png32 image that has 2x non-transparent pixels
* encoding as png8 with hextree results in a fully transparent image
* encoding as png8 with octree results in an image with 1x opaque pixel
* expected: output images resemble the input image

May be related to #1987, #1097, #2292