How to get GD2 generate PNG8 when resizing PNG8 images
GD2 indeed doesn't check what palette size is the source image. From GDToolkit.php:

// Always save PNG images with full transparency.
if ($this-&gt;getType() == IMAGETYPE_PNG) {
  imagealphablending($this-&gt;getResource(), FALSE);
  imagesavealpha($this-&gt;getResource(), TRUE);
}


The only way I could hack PNG8 in there was:

// Always save PNG images with full transparency.
if ($this-&gt;getType() == IMAGETYPE_PNG) {
  imagealphablending($this-&gt;getResource(), FALSE);
  imagesavealpha($this-&gt;getResource(), TRUE);
  imagetruecolortopalette($this-&gt;getResource(), TRUE, 256); // ← hardcoded 256 hack for PNG8
}


I couldn't find a way of determining the palette size of the source image. So by leaving that hack of mine in there the risk is that PNG24 source images will be saved in the styles/ directory as PNG8 files.