Read paper A Systematic Approach to Building High Performance Software-Based CRC Generators
Read PNG (Portable Network Graphics).
TIL alpha is not a must in PNG files. PNG. Specification. Version 1.0. 2. Data Representation:
An alpha channel, representing transparency information on a per-pixel basis, can be included in grayscale and truecolor PNG images.
Alpha channels can be included with images that have either 8 or 16 bits per sample, but not with images that have fewer than 8 bits per sample. Alpha samples are represented with the same bit depth used for the image samples. The alpha sample for each pixel is stored immediately following the grayscale or RGB samples of the pixel.
Transparency control is also possible without the storage cost of a full alpha channel. In an indexed-color image, an alpha value can be defined for each palette entry. In grayscale and truecolor images, a single pixel value can be identified as being “transparent”. These techniques are controlled by the tRNS ancillary chunk type.
If no alpha channel nor tRNS chunk is present, all pixels in the image are to be treated as fully opaque.
TIL PNG uses Latin-1 for textual fields:
A PNG file can store text associated with the image, such as an image description or copyright notice. Keywords are used to indicate what each text string represents. ISO 8859-1 (Latin-1) is the character set recommended for use in text strings [ISO-8859]. This character set is a superset of 7-bit ASCII.
TIL PNG specification includes also rationale which is interesting to read.
PNG. Specification. Version 1.0. 1. Introduction:
The main part of this specification gives the definition of the file format and recommendations for encoder and decoder behavior. An appendix gives the rationale for many design decisions. Although the rationale is not part of the formal specification, reading it can help implementors understand the design. Cross-references in the main text point to relevant parts of the rationale. Additional appendixes, also not part of the formal specification, provide tutorials on gamma and color theory as well as other supporting material.
TIL PNG by intention doesn’t have version number. PNG file signature rationale:
Note that there is no version number in the signature, nor indeed anywhere in the file. This is intentional: the chunk mechanism provides a better, more flexible way to handle format extensions, as explained in Chunk naming conventions.
I have looked in Mac App Store. There’s no app like PNG explorer. For me it would be interesting to have/make such app. Something similar to TweakPNG.
TIL open source exiv2 CLI for exploring
Read paper A Systematic Approach to Building High Performance Software-Based CRC Generators” by Michael E. Kounavis and Frank L. Berry. OpenJDK implements ‘slicing-by-8’ algorithm described in the paper:
Swift uses straightforward naïve CRC32 implementation in at least two places: in Swift standard library and in swift-testing package. Don’t see why Swift standard library couldn’t not have more robust implementation.