raise exception when images are not right
Merge pull request #913 from LipuFei/fix_image

raise exception when images are not right