Almost full implementation of metadata reading.

The PixelFormat class has still an ugly byte array as the common
part. This might need a bit of work. Also unit tests are missing.