OPF-029: file does not match the declared media type
Epubcheck reports: ERROR(OPF-029): The file "cover.png" does not appear
to match the media type image/png, as specified in the OPF file. The manifest says one
format, the bytes say another.
What it means
The OPF manifest declares a media type for every file in the book. Epubcheck opens the file
and looks at what it actually is. Here they disagree: typically a JPEG wearing a
.png name and declared as image/png, or the reverse. Readers that
trust the declaration over the bytes can refuse to render the image.
Why it happens
Somewhere along the line an image was converted and only half the bookkeeping followed. A cover was swapped in with the same filename but a different format, a batch tool renamed extensions without converting anything, or a download produced a JPEG where a PNG once was.
How to fix it
First find out what the file really is. Open it in an image viewer that shows the format,
or check the first bytes (PNG files start with .PNG, JPEGs with
ÿØÿ). Then pick one of two repairs:
- Correct the
media-typeattribute on that file's manifest entry to match the real format. Quick, and fine for validation, though the misleading extension stays. - Or convert the image to the declared format and repack. Cleaner, since name, bytes and declaration all agree afterwards.
If the extension is wrong too, you will usually see PKG-022 reported right next to this one. Same mixup, two symptoms.
The checker reports each mismatch with the manifest line, so you can see exactly which entry to correct.
Check your Epub