Rewrote image parsing code to hopefully compute lazily.