Skip to content

Commit c0e6f82

Browse files
committed
Load image details via input stream rather than file
1 parent 6297e00 commit c0e6f82

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/com/github/stickerifier/stickerify/media/MediaHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ private static boolean isFileSizeLowerThan(File file, long threshold) throws Fil
205205
* @return the image, if supported by {@link ImageIO}
206206
*/
207207
private static ImmutableImage toImage(File file) {
208-
try {
209-
return ImmutableImage.loader().fromFile(file);
208+
try (var inputStream = new FileInputStream(file)) {
209+
return ImmutableImage.loader().fromStream(inputStream);
210210
} catch (IOException _) {
211211
return null;
212212
}

0 commit comments

Comments
 (0)