Fix component ordering in ImageComponent enum.
Fix encoding of large images.
Refactored block splitting.