EPUB FixerKDP upload error scanner

EPUB error guide

PKG_022 wrong file extension for image

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

  • PKG_022 wrong file extension for image
  • Wrong file extension for image in EPUB
  • Image extension does not match file type
  • EPUB image media type mismatch

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

Decide if this report item matches.

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.

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.

Check the affected file first.

Use the Affected area, Source file, Target file, or Problem type rows before editing OPF, nav, XHTML, CSS, or image paths.

Follow the repair decision.

Repairable means one clear structural change. Needs review or Not supported means use the named file, source project, or platform step.

Keep with your repair note.

Copy these fields from the report instead of rebuilding the fix from memory.

Source file
Target path or field
Original error
Repair decision
Next step

1. Example report output

What a PKG_022 report should show.

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

Decide whether extension and references can be aligned.

The file path may appear in several parts of the EPUB.

Scan first

Detect the true image type.

Read the image header and compare extension and OPF media-type.

Safe repair

All references are findable.

Rename or relabel only when every internal reference can be updated consistently.

Manual review

The image is damaged or ambiguous.

Restore or re-export the asset when the file cannot be identified cleanly.

3. Concrete path example

A typical wrong image extension case.

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

Keep image path, type, and references in sync.

Changing only one part of the package can create a new missing-resource error.

Scan first

Find every reference.

Check OPF, XHTML, CSS, nav, NCX, and cover metadata before renaming the image.

Safe fix

The true type is clear.

Align extension and media-type when every reference can be updated.

Stop

The asset cannot be identified.

Return to the original image when the file is corrupted or format detection is unclear.

Start here

Check the image bytes before renaming files.

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.

Matched

What it means

The EPUB has an image file whose name, declared media type, and real image bytes do not agree.

Matched

Can it be fixed automatically?

It can be repaired when the image is readable, the true type is clear, and all references can be updated consistently.

Matched

What to check next

Copy the image path from the validator message.

Matched

What not to assume

It is unsafe when the image bytes are damaged, references are hidden or ambiguous, or the source asset needs replacement.

Common situations

Common PKG_022 cases.

Wrong extension errors often come from manual image replacement or batch export.

A PNG was saved with .jpg extension.

The file is readable, but its name and OPF label are wrong.

Align extension, media type, and references together.

The OPF media type is stale.

The file extension changed but content.opf still says the old type.

Update OPF only if the file bytes confirm the true type.

CSS references the image path.

Renaming the file without CSS updates creates broken links.

Find all references before changing the path.

The image is also corrupted.

If the bytes cannot be identified, extension repair is not enough.

Restore the source asset.

The PKG_022 image extension error text

PKG_022: Wrong file extension for image.

Where wrong image extension errors appear

EPUBCheck sees an image path whose extension does not match the actual image format or OPF declaration.

What it means

The image file name and real image type disagree.

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

Compare extension, detected type, OPF media type, and references.

A safe fix needs the image to be readable and the true type to be clear. Do not rename files without updating every reference.

  1. 1Copy the image path from the validator message.
  2. 2Detect the real image type from the file header.
  3. 3Compare the extension with the OPF manifest media-type.
  4. 4Search XHTML, CSS, nav, NCX, OPF, and cover metadata for references to the path.
  5. 5Update references together or restore the source asset if the image is not readable.

Why KDP checks it

Why validators check image extensions.

EPUB 3.3 package rules

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

EPUBCheck checks EPUB 2 and EPUB 3 files against the official rules and reports package, markup, link, and file-reference problems.

KDP eBook file formats

KDP supports EPUB files that meet Kindle Publishing Guidelines and recommends checking the file with Kindle Previewer before upload.

Can this be fixed safely?

When PKG_022 can be repaired safely.

When automatic repair is safe

It can be repaired when the image is readable, the true type is clear, and all references can be updated consistently.

When you need manual review

It is unsafe when the image bytes are damaged, references are hidden or ambiguous, or the source asset needs replacement.

Before / after 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?

Scan image references before changing the extension.

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 scan

FAQ

Questions authors ask about PKG_022.

Can EPUB Fixer fix PKG_022 automatically?

It can be safe when the file is readable, the true image type is clear, and every reference can be updated.

Should I just rename the image file?

Not by itself. OPF, XHTML, CSS, nav, NCX, and cover metadata may still point to the old path.

How is PKG_022 different from OPF_029?

PKG_022 focuses on the image file extension. OPF_029 focuses on mismatch between the manifest media type and the file.

What if the image is corrupted too?

Then extension repair is not enough. Restore or re-export the original image before retrying.

Related EPUB error guides