Fix where image component decoding takes place.

Fixes #2770, #2847