Plan 9 from Bell Labs’s /usr/web/sources/patch/applied/pngsize/readme
if the channdesc is not CY, then the calculated size in png is wrong by a factor of the number of bytes per pixel. a more invasive but perhaps better patch would create a function chantobpp and use that where required.