RasterFormatException: (y + height) is outside raster in ImagesUtils.createImageFile aborts the whole file (2.4.7)

Author: ralfaouad-TLCreated Sep 18, 2026Updated Sep 22, 2026
Labelsfixed-in-dev

Bug

With --image-output external (the default), processing one PDF aborts the whole file with java.awt.image.RasterFormatException: (y + height) is outside raster from ImagesUtils.createImageFile() → BufferedImage.getSubimage(). No JSON or Markdown is written for that file; the other files in the same directory run are fine. It is the vertical twin of #380 ((x + width) is outside raster, closed 2026-04-03).

Environment

  • opendataloader-pdf 2.4.7 (PyPI wheel, bundled opendataloader-pdf-cli.jar)
  • OpenJDK 17.0.15 (Ubuntu 20.04), Linux 5.15, headless
  • command: java -Djava.awt.headless=true -jar opendataloader-pdf-cli.jar --format json,markdown --image-output external --hybrid off --include-header-footer -o <out> <dir>

The file

A 3-page digital PDF from the public Kleister-NDA dataset (a US SEC exhibit, not attached here for licensing reasons): https://raw.githubusercontent.com/applicaai/kleister-nda/master/documents/5fef505c7e8c60c597f150f2f2976684.pdf. Just before the exception the log shows twice: WARNING: The resulting target buffered image width is <= 0. Fall back to 1.

Stack trace

SEVERE: Exception during processing file .../kleister-ae2962e1f686.pdf: (y + height) is outside raster
java.awt.image.RasterFormatException: (y + height) is outside raster
	at java.desktop/sun.awt.image.IntegerInterleavedRaster.createWritableChild(IntegerInterleavedRaster.java:467)
	at java.desktop/java.awt.image.BufferedImage.getSubimage(BufferedImage.java:1203)
	at org.verapdf.wcag.algorithms.semanticalgorithms.consumers.ContrastRatioConsumer.getPageSubImage(ContrastRatioConsumer.java:243)
	at org.opendataloader.pdf.utils.ImagesUtils.createImageFile(ImagesUtils.java:124)
	at org.opendataloader.pdf.utils.ImagesUtils.writeImage(ImagesUtils.java:108)
	at org.opendataloader.pdf.utils.ImagesUtils.writeFromContents(ImagesUtils.java:71)
	at org.opendataloader.pdf.utils.ImagesUtils.writeFromContents(ImagesUtils.java:94)
	at org.opendataloader.pdf.utils.ImagesUtils.write(ImagesUtils.java:64)
	at org.opendataloader.pdf.processors.DocumentProcessor.generateOutputs(DocumentProcessor.java:492)
	at org.opendataloader.pdf.processors.DocumentProcessor.processFileWithResult(DocumentProcessor.java:148)
	at org.opendataloader.pdf.processors.DocumentProcessor.processFile(DocumentProcessor.java:129)
	at org.opendataloader.pdf.api.OpenDataLoaderPDF.processFile(OpenDataLoaderPDF.java:40)
	at org.opendataloader.pdf.cli.CLIMain.processFile(CLIMain.java:227)
	at org.opendataloader.pdf.cli.CLIMain.processPath(CLIMain.java:156)
	at org.opendataloader.pdf.cli.CLIMain.processDirectory(CLIMain.java:189)
	at org.opendataloader.pdf.cli.CLIMain.processPath(CLIMain.java:147)
	at org.opendataloader.pdf.cli.CLIMain.run(CLIMain.java:109)
	at org.opendataloader.pdf.cli.CLIMain.main(CLIMain.java:58)

Expected

Either clamp the sub-image rectangle to the raster (as #380 did for the horizontal case) or skip that one image and still emit the document's JSON/Markdown, instead of failing the whole file.

Source: opendataloader-project/opendataloader-pdf