Check for corrupt images



I was thinking it would be convenient to have a module that checks for corrupt images and lets you do something about it so that you don’t end up wasting your entire analysis run. Is there anything like? Also, is there a simple/fast way to check for file corruption instead of using imread? imread seems really slow.




Hi Peter,

We’re actually looking into this right now as part of our high-content screening work. Oftentimes, as images come off the scanner, something goes wrong with a single image and the machine may or may not correct for it. This usually causes the pipeline to fail outright.

Since the images in this case are always named in a consistent manner, we can check for image file naming mismatches or deletions (which is a tell-tale sign that a file is corrupt), and handle them accordingly. Only if there is an apparent naming inconsistency do we actually read the image to check on its integrity.

Right now, we’re testing this out on the front end, during the 1st cycle of LoadImages. However, it’s difficult to check a priori for corruption without reading the whole thing; MATLAB’s imfinfo is not that much quicker. Looking at file size consistency may be another way, but we’re finding that obtaining even that simple information for a large set of images can be very time-prohibitive.


Thanks for the heads up. I was actually thinking about cases where the file is corrupt, but the byte-size and naming are still fine (programs just won’t open the image file - ImageJ, photoshop, imwrite). I guess that would be an even harder problem to test for as it’s not just the saving or even the file size but you basically then have to open the file. I suppose I’ll try to write an error catch within the load images that basically flasg the image and lets me continue on with the analysis instead of stopping.

I hadn’t even thought about simpler problems - file misnames and file sizes and such. I guess I’ll have to think about that as well.

Thanks again!