Skip to content

Commit

Permalink
Check BufferedImage before conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
yuripourre committed Dec 8, 2017
1 parent fb8a5d5 commit b80be8b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/com/harium/etyl/loader/image/AWTReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public BufferedImage loadImage(InputStream input) throws IOException {
}

public static BufferedImage convertImage(BufferedImage original) {
if (BufferedImage.TYPE_INT_ARGB == original.getType()) {
return original;
}
BufferedImage converted = new BufferedImage(original.getWidth(), original.getHeight(), BufferedImage.TYPE_INT_ARGB);
converted.getGraphics().drawImage(original, 0, 0, null);
return converted;
Expand Down

0 comments on commit b80be8b

Please sign in to comment.