So, today I noticed a serious issue with my earlier PNG implementation: HTML5 Canvas doesn’t treat colors as exactly as I’d like to when alpha channel is active on a pixel. This results RGB data on a semitransparent pixel to be incorrect when reading it. So I can’t use a PNG image with alpha transparency.
Now I’ve sorted out this issue by making the image larger, dropping all 7-bit stuff and providing everything as a 24-bit PNG image. This actually compresses better than image with an alpha channel which is nice.
You can find the PHP source as well as an example page at https://settlers2.net/canvas/