It turned out that there were problems with the image files because the regenerate thumbnails plugin would also fail.
Big headache with a WordPress.com to self-hosted transfer that was performed in an unusual manner.
Your plugin is working fine on valid image files.