EPUBCheck MED-004: image header looks damaged
Updated:
EPUBCheck MED-004 is an error message: “Image file header may be corrupted.” An image file's header looks damaged, so the image may not display. EPUBCheck reads the first bytes of each image to check its format and size, and here they do not make sense.
The official message
Image file header may be corrupted.
- Default severity
- Error. The EPUB breaks a rule of the specification and is invalid. Stores and Send to Kindle may reject it, and EPUBCheck exits with status 1.
- EPUBCheck version
- 5.4.0
Typical causes
- An image truncated in a copy, a download or a failed ZIP operation.
- An image saved by a faulty tool, or a file whose extension does not match its content.
How to fix it
- Open the image in an image viewer: if it fails or shows only part of the picture, it is damaged.
- Re-export the image from its source and replace the file, keeping the same name or updating every reference to it.
- Rebuild the EPUB and run EPUBCheck again to confirm the message is gone.
When it's not this
If the image cannot be decoded at all, EPUBCheck reports PKG-021; a wrong extension is PKG-022.
Terms used here
Other MED messages
MED-003Picture "img" elements must reference core media type resources, but found resource "…" of type "…".MED-005Media Overlay audio reference … to non-standard audio type … found.MED_007Picture "source" elements must define a "type" attribute when they reference foreign resources; found resource "…" of type "…".MED-008The time specified in the clipBegin attribute must not be after clipEnd.MED-009The time specified in the clipBegin attribute must not be the same as clipEnd.MED_010EPUB Content Documents referenced from a Media Overlay must specify the "media-overlay" attribute.
Sources
Message text and severity from EPUBCheck 5.4.0 (W3C, BSD-3-Clause). Explanation by EpubCC.