Match the report title.
Look for "PKG_022 wrong file extension for image" or the closest title above. Keep the original EPUBCheck, KDP, or Kindle Previewer wording if it differs.
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 when the message does not name the affected path. The report shows affected paths and repair decisions, not manuscript text.
Fixed-layout, DRM, or source-workflow issue? Check unsupported or review-first EPUB cases.
Match these report titles
Use this guide when
Your message matches "PKG_022 wrong file extension for image" or one of the report titles above.
Upload if
You have the exported reflowable .epub and need the affected path, file, field, or repair decision before editing.
Handle outside this tool
Use the source tool or publishing workflow for DOCX, PDF, KPF, KCB, fixed-layout, comics, image-first books, DRM, visual design, or KDP listing and approval problems.
Read the scan report
Use the report label, affected file, and repair decision together. A matching title alone is not enough if the file path or EPUB structure points to a different problem.
Look for "PKG_022 wrong file extension for image" or the closest title above. Keep the original EPUBCheck, KDP, or Kindle Previewer wording if it differs.
Use the Affected area, Source file, Target file, or Problem type rows before editing OPF, nav, XHTML, CSS, or image paths.
Repairable means one clear structural change. Needs review or Not supported means use the named file, source project, or platform step.
Copy these fields from the report instead of rebuilding the fix from memory.
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.
Start here
PKG_022 usually means the file extension does not match the real image format. Renaming can be safe only when every reference and manifest item is updated consistently.
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.
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
The EPUB has an image file whose name, declared media type, and real image bytes do not agree.
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.
Can this be fixed safely?
It can be repaired when the image is readable, the true type is clear, and all references can be updated consistently.
It is unsafe when the image bytes are damaged, references are hidden or ambiguous, or the source asset needs replacement.
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.