How to Check a Consolidated Photo Library for Corrupted Files
To check a consolidated photo library, scan every image with a decoder that reads the image data, save a report of files that fail or trigger warnings, then inspect those files individually before replacing or restoring anything. A quick thumbnail or file-size check can find obvious problems, but it cannot establish that the full image is readable. This workflow uses ImageMagick’s magick identify and is intended for a library stored on a local or mounted drive.
What a corruption check can—and cannot—tell you
A file may have a familiar extension and plausible size yet contain truncated or damaged image data. Conversely, a file that opens in one viewer may still produce warnings or fail in a different decoder. A scan records how one tool reads a file; it does not prove that every pixel is visually correct or that every application will interpret the file identically.
ImageMagick’s magick identify reports image characteristics and can report incomplete or corrupt files. For a meaningful check, use +ping to request a full read: ImageMagick explains that its default ping mode reads only the information needed for basic identification and may avoid reading the entire image. Add -regard-warnings so warnings affect the command’s exit status. ImageMagick Identify documentation, ImageMagick Basic Usage
Treat the result as triage. A reported warning deserves review; it is not, by itself, proof that the photo is unusable. A clean scan means this decoder completed without reporting a problem, not that the picture looks right or that all file-format-specific details are valid.
Prepare the library before scanning
Start with a stable copy or backup. Do not run a repair or conversion over the only copy of a file: some recovery attempts can alter data, while an interrupted write can make a bad file worse. If the consolidated library spans several drives or folders, note every root directory you intend to include.
Close software that is actively importing, editing, or synchronizing the collection. This reduces the chance that a file changes while being scanned. Confirm that the mounted drives are available and that the scan account can read them. A permission error or disconnected volume must be treated as an unscanned area, not a clean result.
Install ImageMagick from its official distribution for your operating system, then confirm that the magick command is available in a terminal. Test it on a few known images first. ImageMagick’s command spelling is for version 7; older installations may use different command names. Do not interpret a missing-command or unsupported-format error as evidence that a file is corrupt.
Run a full scan and capture the report
On macOS or Linux, Bash can walk a library recursively and write failures and warnings to a separate log. Replace /path/to/photo-library and the report path with your actual locations. Keep the report outside the library being scanned so the scan does not treat it as an image.
: > "$HOME/photo-scan-errors.log"
find "/path/to/photo-library" -type f -print0 |
while IFS= read -r -d '' file; do
if ! magick identify +ping -regard-warnings "$file" >/dev/null 2>>"$HOME/photo-scan-errors.log"; then
printf '%s\n' "$file"
fi
done
The terminal prints the paths of files whose check returned a failure; the log captures diagnostic messages from ImageMagick. The loop includes every file, so non-image files may also be reported as unrecognized formats. That is expected if the library contains sidecar files, documents, or other non-image content. For a mixed archive, treat “unknown format” separately from a decoder error and narrow the scan to known image extensions if needed. Extension filtering can miss images whose names use unusual or absent extensions.
If the log is empty and no paths were printed, the run produced no diagnostics and no failures under this decoder’s check. Confirm that the root path was correct and that the scan finished; an empty report caused by a typo, inaccessible drive, or interrupted command is not a pass. For very large libraries, run one folder or drive at a time and label each report so you can see what was actually covered.
Review each flagged file safely
Use the printed path to locate the original, then run the check on just that file to get a clearer diagnostic: magick identify +ping -regard-warnings "/full/path/to/file.jpg". Record the message and compare it with what a second viewer or editor does. Check whether the file displays fully, only partially, or not at all. Be aware that an application may show an embedded preview even when the main image data is damaged.
Separate three cases in your notes: a file that fails to decode, one that decodes with a warning, and one that decodes but looks unexpectedly incomplete or visually damaged. This makes follow-up more useful than treating every warning as identical. Multi-frame formats such as GIF or TIFF can contain several images in one file; inspect the relevant frames or pages if the problem appears only after the first one.
Choose a recovery path without overwriting the source
If another copy exists, compare it before attempting repair. A file hash can tell whether two copies have exactly the same content: Microsoft documents that matching hashes identify identical file contents, while different names or extensions do not affect the hash. For example, PowerShell’s Get-FileHash uses SHA-256 by default. Microsoft Learn: Get-FileHash
Matching hashes show that two copies are byte-for-byte identical; they do not establish that either copy is healthy. If both copies fail the same way, look for another backup or original source. If one passes and one fails, preserve the working copy and replace the damaged copy only after confirming the files are the same intended photo. Keep the original flagged file until the replacement is verified.
If no good copy is available, make a separate duplicate of the flagged file before trying a format-specific recovery tool. Recheck any recovered output from scratch, open it in a viewer, and compare dimensions or other expected characteristics. ExifTool notes that it is not designed as an image validator; its -validate checks provide additional checks mainly for JPEG and TIFF, so use it as a supplementary diagnostic rather than a universal pass/fail test. ExifTool FAQ: Can ExifTool be used as an image validator?
Confirm coverage and keep a useful record
Before calling the audit complete, verify that every intended folder was included, the scan reached the end, and the report was saved. Review messages that indicate an unreadable drive, permission issue, unsupported format, or missing decoder separately from confirmed image-read failures. Re-run the check on restored files and sample the collection in an image viewer, with extra attention to flagged items and multi-frame files.
Keep the date of the scan, ImageMagick version, folders scanned, and the failure log with your maintenance notes. That record makes a future scan comparable and helps distinguish an old warning from a new read problem. A careful check combines a full decoder read, targeted visual review, and verification of any replacement copy; no single command can make those judgments for you.
