From cb2849c4f2f5c127e8b3e5136875e359b5b6c043 Mon Sep 17 00:00:00 2001
From: Georgy Litvinov <git@litvinovg.pro>
Date: Sat, 12 Dec 2020 22:07:13 +0100
Subject: [PATCH] Skip crop on 0 crop

---
 src/main/java/w2phtml/base/BinaryGraphicsDocument.java | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/main/java/w2phtml/base/BinaryGraphicsDocument.java b/src/main/java/w2phtml/base/BinaryGraphicsDocument.java
index ce468b0..00834a5 100644
--- a/src/main/java/w2phtml/base/BinaryGraphicsDocument.java
+++ b/src/main/java/w2phtml/base/BinaryGraphicsDocument.java
@@ -229,6 +229,9 @@ public class BinaryGraphicsDocument implements OutputFile {
 		}
 		extractPPI();
 		int[] offsets = getOffsets(style);
+		if (offsets[0] == 0 && offsets[1] == 0 && offsets[2] == 0 && offsets[3] == 0) {
+			return;
+		}
 		ByteArrayInputStream bis = new ByteArrayInputStream(blob);
 		
 		try {
@@ -251,6 +254,7 @@ public class BinaryGraphicsDocument implements OutputFile {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		} catch (RasterFormatException e ) {
+			System.out.println(e.getLocalizedMessage());
 			e.printStackTrace();
 		}