Refactor image format loops to use array initialization instead.
Add stopwatch timer to the example code.