fast-png
fast-png copied to clipboard
1bit greyscale encoder support
Any plans on supporting bit depths other than 8 and 16? I would have use for a 1bit greyscale implementation. Also not averse to contributing but would like some hints why other depths weren't implemented before I spent time and dig in to avoid double work.
Great library btw. I'm really impressed with the speed, it even beat the ImageDecoder from the browser built-in WebCodecs for small greyscale pngs.
Hello, would you be able to share a problematic image with us? There is nothing that specifically forbids 1bit images (https://github.com/image-js/fast-png/blob/master/src/PngDecoder.ts#L475-L486), but it is not tested because we have never encountered such images.
oh sorry, I wasn't precise enough. I meant 1bit greyscale support for the encoder: https://github.com/image-js/fast-png/blob/bdb81f93cc55aa89b312b50e5e2e8a39cdbde657/src/PngEncoder.ts#L100
We are using fast-png to create, store and read bitmasks for that images with 1bit depth would be much smaller than greyscale images. I'll see if I can create one with another encoder.
I see. Feel free to try and implement it here if you want!
ok, so I gather there's no reason it wasn't done before just that there was no need up to now? Just making sure there's no reason like there's no good 1bit datastructure in javascript ;)
just for reference: