This commit is contained in:
JianGuo 2024-07-16 16:19:41 +08:00
parent afea000336
commit 38ee383033
1 changed files with 2 additions and 2 deletions

View File

@ -142,13 +142,13 @@ public class SaneSessionUtils {
try { try {
saneDevice.open(); saneDevice.open();
BufferedImage bufferedImage = saneDevice.acquireImage(); BufferedImage bufferedImage = saneDevice.acquireImage();
File file = FileUtil.createTempFile("sane","png",true); File file = FileUtil.createTempFile("sane-",".png",true);
ImageIO.write(bufferedImage, "png", file); ImageIO.write(bufferedImage, "png", file);
return file; return file;
} catch (IOException | SaneException e) { } catch (IOException | SaneException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
}finally { }finally {
if(saneDevice != null){ if(saneDevice != null && saneDevice.isOpen()){
saneDevice.close(); saneDevice.close();
} }
} }