Skip to content
EPUBCheck · Package and ZIP container

PKG-022

Updated:

EPUBCheck PKG-022 is a warning message: “Wrong file extension for image. The image is a "…" file but has the file extension "…".” An image's extension does not match its real format, for example a PNG file named .jpg.

The official message

Wrong file extension for image. The image is a "%1$s" file but has the file extension "%2$s".

Default severity
Warning. The EPUB is still valid, but something is likely to cause problems in some reading apps. EPUBCheck exits with 0 unless you pass --failonwarnings.
EPUBCheck version
5.4.0

%1$s, %2$s… are filled in with the file, value or element EPUBCheck found.

Typical causes

  • Images renamed instead of converted.
  • Tools that save in one format but keep the old extension.

How to fix it

  • Either rename the file to the right extension or convert it to the format its name says.
  • Make the manifest media type match the real format too (image/png, image/jpeg…).
  • After renaming, update every reference to the file: the manifest in the package document, links and image sources in the XHTML, and url() references in the CSS.

Terms used here

Other PKG messages

  • PKG-021 Corrupted image file encountered.
  • PKG-024 Uncommon EPUB file extension.
  • PKG-025 Publication resource must not be located in the META-INF directory
  • PKG-026 Obfuscated resource must be a Font Core Media Type (was declared as "…" in "…").
  • PKG-017 Uncommon EPUB file extension.
  • PKG-027 Could not extract EPUB ZIP content, probably due to file names not encoded in UTF-8.

Message text and severity from EPUBCheck 5.4.0 (W3C, BSD-3-Clause). Explanation by EPUBLab.

FAQ

What does EPUBCheck PKG-022 mean?

EPUBCheck PKG-022 is a warning message: “Wrong file extension for image. The image is a "…" file but has the file extension "…".” An image's extension does not match its real format, for example a PNG file named .jpg.

Is PKG-022 an error?

PKG-022 is reported as warning by default. The EPUB is still valid, but something is likely to cause problems in some reading apps. EPUBCheck exits with 0 unless you pass --failonwarnings.