From cb2ed0c766b90de817a25a8f61754b8931916ca1 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 20 Sep 2023 13:23:02 -0400 Subject: [PATCH] Testing image reader --- src/engine/InterestManagement/HeightMap.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/engine/InterestManagement/HeightMap.java b/src/engine/InterestManagement/HeightMap.java index b399c912..af377ec6 100644 --- a/src/engine/InterestManagement/HeightMap.java +++ b/src/engine/InterestManagement/HeightMap.java @@ -20,6 +20,7 @@ import engine.objects.Zone; import org.pmw.tinylog.Logger; import javax.imageio.ImageIO; +import javax.imageio.ImageReader; import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; @@ -30,6 +31,7 @@ import java.nio.file.Paths; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; +import java.util.Iterator; import java.util.stream.Stream; import static java.lang.Math.abs; @@ -315,6 +317,11 @@ public class HeightMap { // Load pixel data + Iterator readers = ImageIO.getImageReadersByFormatName("TGA"); + while (readers.hasNext()) { + System.out.println("reader: " + readers.next()); + } + try (Stream filePathStream = Files.walk(Paths.get(ConfigManager.DEFAULT_DATA_DIR + "heightmaps/TARGA/"))) { filePathStream.forEach(filePath -> { @@ -323,6 +330,7 @@ public class HeightMap { try { BufferedImage heightmapImage = ImageIO.read(imageFile); + int width = heightmapImage.getWidth(); } catch (IOException e) { throw new RuntimeException(e); }