Skip to content

Instantly share code, notes, and snippets.

View learosema's full-sized avatar
👋
Hello World!

Lea Rosema learosema

👋
Hello World!
View GitHub Profile
@learosema
learosema / pngencode.cpp
Created March 8, 2024 00:16 — forked from mmalex/pngencode.cpp
bug fix png encoder
// by alex evans, 2011. released into the public domain.
// based on a first ever reading of the png spec, it occurs to me that a minimal png encoder should be quite simple.
// this is a first stab - may be buggy! the only external dependency is zlib and some basic typedefs (u32, u8)
//
// VERSION 0.02! now using zlib's crc rather than my own, and avoiding a memcpy and memory scribbler in the old one
// by passing the zero byte at the start of the scanline to zlib first, then the original scanline in place. WIN!
//
// more context at http://altdevblogaday.org/2011/04/06/a-smaller-jpg-encoder/.
//
// follow me on twitter @mmalex http://twitter.com/mmalex
@learosema
learosema / pngencode.cpp
Created March 8, 2024 00:15 — forked from anonymous/pngencode.cpp
I just read the png spec, and came up with this as a minimal, zlib based png encoding of a truecolour image with 1-4 channels
// by alex evans, 2011. released into the public domain.
// based on a first ever reading of the png spec, it occurs to me that a minimal png encoder should be quite simple.
// this is a first stab - may be buggy! the only external dependency is zlib and some basic typedefs (u32, u8)
//
// more context at http://altdevblogaday.org/2011/04/06/a-smaller-jpg-encoder/.
//
// follow me on twitter @mmalex http://twitter.com/mmalex
//
u32 crc_table[256]={0};
void make_crc_table(void)