do not crash when using invalid images (e.g. pdf renamed to jpg)