What it means
The EPUB has an image file whose name, declared media type, and real image bytes do not agree.
EPUB error guide
Use this when EPUBCheck reports PKG_022 or says an image has the wrong file extension. Compare the packaged image bytes, extension, and OPF manifest media type.
Scan the EPUB to check file paths and see what can be repaired or needs manual review. Your original EPUB stays unchanged.
Need fixed-layout, DRM, or source-file help? Check unsupported or review-first EPUB cases.
Match these report titles
Start here
In an EPUB package, PKG_022 usually means the file extension does not match the real image format.
The EPUB has an image file whose name, declared media type, and real image bytes do not agree.
It can be repaired when the image is readable, the true type is clear, and all references can be updated consistently.
Copy the image path from the validator message.
It is unsafe when the image bytes are damaged, references are hidden or ambiguous, or the source asset needs replacement.
1. Example report output
The report should show the real file type and every package reference that depends on the current path.
EPUBCheck message
ERROR(PKG-022): Wrong file extension for image.
Affected file
OEBPS/Images/cover.jpg.
EPUB Fixer report
Detected PNG file header, but extension is .jpg and OPF media-type is image/jpeg.
Do this next
Rename and update references only when the true image type is clear.
Do not do this
Do not rename the file without updating OPF, XHTML, CSS, nav, or cover metadata references.
Safe repair means aligning extension, media type, and every internal reference to the same image file.
2. Next step
The file path may appear in several parts of the EPUB.
Scan first
Read the image header and compare extension and OPF media-type.
Safe repair
Rename or relabel only when every internal reference can be updated consistently.
Manual review
Restore or re-export the asset when the file cannot be identified cleanly.
3. Concrete path example
The path says JPEG, but the bytes are PNG.
EPUBCheck: ERROR(PKG-022): OEBPS/Images/diagram.jpg: Wrong file extension for image. Report: Detected type: image/png Current path: OEBPS/Images/diagram.jpg Manifest media-type: image/jpeg References found: content.opf, chapter.xhtml Fix decision: safe only if all references can be updated After: align extension, media-type, and references, then validate again
If CSS or XHTML references cannot be found reliably, do not rename the image automatically.
Quick decision
Changing only one part of the package can create a new missing-resource error.
Scan first
Check OPF, XHTML, CSS, nav, NCX, and cover metadata before renaming the image.
Safe fix
Align extension and media-type when every reference can be updated.
Stop
Return to the original image when the file is corrupted or format detection is unclear.
Common situations
Wrong extension errors often come from manual image replacement or batch export.
The file is readable, but its name and OPF label are wrong.
Align extension, media type, and references together.
The file extension changed but content.opf still says the old type.
Update OPF only if the file bytes confirm the true type.
Renaming the file without CSS updates creates broken links.
Find all references before changing the path.
If the bytes cannot be identified, extension repair is not enough.
Restore the source asset.
PKG_022: Wrong file extension for image.
EPUBCheck sees an image path whose extension does not match the actual image format or OPF declaration.
What it means
Manual replacement, export cleanup, or batch processing can leave PNG, JPEG, SVG, or GIF files with stale extensions or media types.
Before you edit
A safe fix needs the image to be readable and the true type to be clear. Do not rename files without updating every reference.
Why KDP checks it
The OPF file is the EPUB's map: metadata, file list, reading order, and navigation wiring. KDP and EPUBCheck use it to decide whether the book package is coherent.
EPUBCheck checks EPUB 2 and EPUB 3 files against the official rules and reports package, markup, link, and file-reference problems.
KDP supports EPUB files that meet Kindle Publishing Guidelines and recommends checking the file with Kindle Previewer before upload.
Repair example
Before: diagram.jpg is actually a PNG and content.opf says image/jpeg. After: extension, media-type, and references agree if all references are known.
Ready to retry?
Upload the EPUB that produced PKG_022. The report should name the image path and show which references must change if the file is renamed.
Upload EPUB to scanFAQ
It can be safe when the file is readable, the true image type is clear, and every reference can be updated.
Not by itself. OPF, XHTML, CSS, nav, NCX, and cover metadata may still point to the old path.
PKG_022 focuses on the image file extension. OPF_029 focuses on mismatch between the manifest media type and the file.
Then extension repair is not enough. Restore or re-export the original image before retrying.