4 ms·
Despite the fact that it's pretty good stuff, shouldn't the title says it's for Android notification ?
by Xoros 9y ago
Despite the fact that it's pretty good stuff, shouldn't the title says it's for Android notification ?
- _alastair 9y agoAuthor here. The post is a combination of two separate things: creating a PNG file via JavaScript typed arrays, then using that PNG in an (Android-specific) web notification. I added a subtitle to the Medium post, but should have considered the fact that it won't show up anywhere else. Not sure it would fit if it was appended to the end of the title here.
- andrewla 9y agoThat was the goal, but the underlying library is general-purpose. Writing a minimal uncompressed PNG writer from scratch is a fun exercise; the spec is pretty clear and the only tricky part, really, is getting the uncompressed zlib part right, especially since the block sizes are undocumentedly little-endian, while everything else is big-endian. Self-contained code for image generation and consumption can be pretty useful. It's one of the reasons that I like farbfeld, suckless's incredible simple binary image format, because libraries for processing it are essentially unnecessary since the format itself is so straightforward.
- _alastair 9y ago> especially since the block sizes are undocumentedly little-endian, while everything else is big-endian. Yes! That stumped me for a long time. Along the way to solving it I found this great Stack Overflow answer where the creator of ADLER32 popped in to give some advice: https://stackoverflow.com/questions/32633486/why-are-png-deflate-block-lengths-being-ignored#comment53120790_32635822 https://stackoverflow.com/questions/32633486/why-are-png-def... "Also just realized that you are that Mark Adler."
- petercooper 9y agoThat's a crucial point, though it doesn't affect how interesting the piece is. But since HN policy is to keep the original headline whatever it is I don't bother tweaking them anymore.