image: Deal with bad images.

Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>