diff options
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java b/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java index 85d14f8..c9d5cd7 100644 --- a/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java +++ b/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java @@ -236,8 +236,20 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine { */
private SignaturePlaceholderData checkImage(PDXObjectImage image) throws IOException {
BufferedImage bimg = image.getRGBImage();
- if(bimg.getHeight() < 10 || bimg.getWidth() < 10)
+ if (bimg == null) {
+ String type = image.getSuffix();
+ if (type != null) {
+ type = type.toUpperCase() + " images";
+ } else {
+ type = "Image type";
+ }
+ log.info("Unable to extract image for QRCode analysis. " + type + " not supported. Add additional JAI Image filters to your classpath. Refer to https://jai.dev.java.net. Skipping image.");
+ return null;
+ }
+ if(bimg.getHeight() < 10 || bimg.getWidth() < 10) {
+ log.debug("Image too small for QRCode. Skipping image.");
return null;
+ }
LuminanceSource source = new BufferedImageLuminanceSource(bimg);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
|