From 765070ae89592886c7c82c8c3f4e2466a5a17c04 Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Sat, 4 Apr 2020 14:36:46 +0300 Subject: [PATCH] Use OpenIMAJ for loading images because Java standard library is buggy --- pom.xml | 5 +++++ src/main/java/eu/svjatoslav/meviz/htmlindexer/Utils.java | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 9ad5714..9ca1fcf 100644 --- a/pom.xml +++ b/pom.xml @@ -28,6 +28,11 @@ tika-core 1.18 + + org.openimaj + core-image + 1.3.5 + diff --git a/src/main/java/eu/svjatoslav/meviz/htmlindexer/Utils.java b/src/main/java/eu/svjatoslav/meviz/htmlindexer/Utils.java index ba0d23c..172ec44 100755 --- a/src/main/java/eu/svjatoslav/meviz/htmlindexer/Utils.java +++ b/src/main/java/eu/svjatoslav/meviz/htmlindexer/Utils.java @@ -28,7 +28,8 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.zip.CRC32; -import static javax.imageio.ImageIO.read; +import static org.openimaj.image.ImageUtilities.createBufferedImage; +import static org.openimaj.image.ImageUtilities.readMBF; public class Utils { private static File lastLoadedFile; @@ -46,8 +47,7 @@ public class Utils { if (file.equals(lastLoadedFile)) return lastLoadedBufferedImage; - System.out.println("Loading image: " + file.getPath()); - lastLoadedBufferedImage = read(file); + lastLoadedBufferedImage = createBufferedImage(readMBF(file)); lastLoadedFile = file; if (lastLoadedBufferedImage == null) { -- 2.20.1