TL;DR In the latest release of our PDF library JPedal (2026.11), we added experimental support for JPEG XL images inside PDF files, which use the new JXLDecode filter. You do not need any new code to use it: if a PDF contains JXL images, JPedal will now decode them when you render pages, extract images or open the file in the JPedal Viewer. It is marked as experimental because JPEG XL is not part of the PDF specification nor endorsed by the PDF Association (although the PDF Association has said it plans to add it). A couple of PDF creation tools have started using it unofficially, and we support it so that JPedal can open those files.
Contents:
- What is a PDF filter?
- What is JXLDecode?
- Why is it experimental?
- Requirements
- How to render a PDF with JPEG XL images in Java
- How to extract JPEG XL images from a PDF in Java
- Frequently asked questions
What is a PDF filter?
Most of the data in a PDF file is stored in streams, and a stream is usually compressed. The Filter entry in the stream’s dictionary tells the PDF reader how the data was encoded, so it knows how to decode it again.
Some filters are general purpose, such as FlateDecode, which is used for most page content. Others are designed specifically for images, such as DCTDecode (JPEG), JPXDecode (JPEG 2000) and JBIG2Decode (black and white scanned images). You can see the full list of filters JPedal handles in our supported PDF features page.
What is JXLDecode?
JXLDecode is the filter for images compressed with JPEG XL. JPEG XL is a modern image format which gives better compression than JPEG, supports both lossy and lossless images, and can store high dynamic range (HDR) images with much higher bit depths.
HDR is the main reason people want it in PDF, and a couple of PDF creation tools have started writing JXL images into PDF files. This is unofficial. The PDF Association has said it intends to add JPEG XL as its preferred solution for HDR images, but it has not yet published or endorsed a JXL filter.
JXL also works differently from most PDF image filters. Formats such as CCITTFaxDecode and JBIG2Decode store just the compressed image data (a codestream), and the PDF’s image dictionary provides everything else, such as the width, height, colour space and bits per component. JXL is a box format, like JPEG and JPEG 2000, so the data contains a header and metadata as well as the pixels. That means the same information can be recorded twice, once in the PDF and once in the JXL file, and there are no rules for reconciling the two or deciding which one wins if they conflict.
Why is it experimental?
JPEG XL is not yet part of ISO 32000-2 (the PDF 2.0 specification), and the PDF Association has not yet endorsed it. There is no agreed definition of the filter or of how a JXL image should be embedded, so questions such as how colour spaces and transparency should be handled, and what to do when the JXL header disagrees with the PDF, are still open.
We have added support because files using it already exist, but we may change how JPedal handles these images if a standard way of using them is agreed. Bear in mind that most PDF viewers cannot display JXL images yet, so you should not create PDF files with them for general distribution.
Requirements
- JPedal 2026.11 or newer, either the trial or a licensed build, on your class or module path. See how to add JPedal as a Maven dependency
- Java 17 or newer
- A PDF file containing images encoded with
JXLDecode
How to render a PDF with JPEG XL images in Java
JXL images are decoded as part of the normal rendering process, so you can use the same code that you would for any other PDF. The ConvertPagesToImages class renders each page to a BufferedImage:
ConvertPagesToImages convert = new ConvertPagesToImages("inputFile.pdf");
//convert.setPassword("password"); //if password needed
try {
if (convert.openPDFFile()) {
int pageCount = convert.getPageCount();
for (int page = 1; page <= pageCount; page++) {
BufferedImage image = convert.getPageAsImage(page);
}
}
} catch (Exception e) {
e.printStackTrace();
}
convert.closePDFfile();
You can also convert the pages straight to image files from the command line:
java -jar jpedal.jar --convert "inputFileOrFolder" "outputFolder" png
If you just want to check that a file displays correctly, you can open it in the JPedal Viewer:
java -jar jpedal.jar --view "inputFile.pdf"
How to extract JPEG XL images from a PDF in Java
The ExtractImages class gives you the raw images used on each page, so any JXL images will be decoded and returned as a BufferedImage:
ExtractImages extract = new ExtractImages("inputFile.pdf");
//extract.setPassword("password");
if (extract.openPDFFile()) {
int pageCount = extract.getPageCount();
for (int page = 1; page <= pageCount; page++) {
int imagesOnPageCount = extract.getImageCount(page);
for (int i = 0; i < imagesOnPageCount; i++) {
BufferedImage image = extract.getImage(page, i, true);
}
}
}
extract.closePDFfile();
If you want the images written straight to disk in another format, such as PNG, you can use the static convenience method:
ExtractImages.writeAllImagesToDir(
"inputFileOrFolder",
"outputFolder",
"png",
true,
false);
This is a useful way to convert JXL images in a PDF to a format which other tools can open.
Frequently asked questions
Do I need to change my code to support JPEG XL images?
No. The support is built into JPedal’s image decoding, so any existing code which renders pages or extracts images will handle JXLDecode streams once you update to JPedal 2026.11.
Is JPEG XL part of the PDF specification?
Not yet. The PDF Association plans to add it, but it is not part of ISO 32000 and has not been endorsed yet. It has been added unofficially by a couple of PDF creation tools, which is why our support is marked as experimental.
Will other PDF viewers display JXL images?
Most will not at the moment. Support is still very limited, so a PDF containing JXL images may show blank areas or errors in other software.
Can I read standalone JPEG XL files in Java?
Yes, that is handled by our image library JDeli rather than JPedal. See how to read JPEG XL images in Java.
We have been working with PDFs for over 25 years and have other resources to help you learn more about the PDF format.