From 193674d6f0f0cf1b6e2060e158f7d6b8ae3725d2 Mon Sep 17 00:00:00 2001 From: Nilstrieb Date: Fri, 21 May 2021 19:22:50 +0200 Subject: [PATCH] wtf git --- .../com/github/nilstrieb/commands/util/EmoteAddCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/nilstrieb/commands/util/EmoteAddCommand.java b/src/main/java/com/github/nilstrieb/commands/util/EmoteAddCommand.java index ffe7b09..bb74507 100644 --- a/src/main/java/com/github/nilstrieb/commands/util/EmoteAddCommand.java +++ b/src/main/java/com/github/nilstrieb/commands/util/EmoteAddCommand.java @@ -116,8 +116,8 @@ public class EmoteAddCommand extends Command { private byte[] resizeImage(byte[] bytes, String format, int size) throws IOException { reply("Image size too big (" + bytes.length / 1000 + "kB). Resizing image..."); Image image = ImageIO.read(new ByteArrayInputStream(bytes)); - int ratio = image.getHeight(null) / image.getWidth(null); - image = image.getScaledInstance(size, size * ratio, Image.SCALE_SMOOTH); + double ratio = (double)image.getHeight(null) / (double)image.getWidth(null); + image = image.getScaledInstance(size, (int) (size * ratio), Image.SCALE_SMOOTH); ByteArrayOutputStream out = new ByteArrayOutputStream(); BufferedImage bufferedImg = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB);