inspect the files with a tool like “imagemagick”. compare the properties of the breaking and good files. see anything that tells them apart?
can you create files that cause this?
can you edit these breaking files with some other program to redact them while maintaining their breaking nature?