Validates image to avoid imagine exception
Removed unused clause & added unit test
Merge pull request #660 from Bladrak/validate_image

Validates image to avoid imagine exception