1 /* Fake a PNG - just write it out directly. */
3 #include <zlib.h> /* for crc32 */
15 put_chunk(const unsigned char *chunk, uInt length)
19 put_uLong(length-4); /* Exclude the tag */
21 fwrite(chunk, length, 1, stdout);
23 crc = crc32(0, Z_NULL, 0);
24 put_uLong(crc32(crc, chunk, length));
27 const unsigned char signature[] =
29 137, 80, 78, 71, 13, 10, 26, 10
32 const unsigned char IHDR[] =
34 73, 72, 68, 82, /* IHDR */
35 0, 0, 0, 1, /* width */
36 0, 0, 0, 1, /* height */
38 0, /* color type: greyscale */
39 0, /* compression method */
40 0, /* filter method */
41 0 /* interlace method: none */
44 const unsigned char unknown[] =
46 'u', 'n', 'K', 'n' /* "unKn" - private safe to copy */
52 fwrite(signature, sizeof signature, 1, stdout);
53 put_chunk(IHDR, sizeof IHDR);
56 put_chunk(unknown, sizeof unknown);