我在數據庫中存儲了一些圖像,同時檢索它們,我想將其大小調整爲177x122。我怎麼能在JAVA中做到這一點? 這是我用來從數據庫檢索圖像的一些代碼,需要做些什麼改變才能獲得177x122的圖像。從數據庫中以不同大小檢索圖像
PreparedStatement pstm1 = con.prepareStatement("select * from image");
ResultSet rs1 = pstm1.executeQuery();
while(rs1.next()) {
InputStream fis1;
FileOutputStream fos;
String image_id;
try {
fis1 = rs1.getBinaryStream("image");
image_id=rs1.getString("image_id");
fos = new FileOutputStream(new File("images" + (image_id) + ".jpg"));
int c;
while ((c = fis1.read()) != -1) {
fos.write(c);
}
fis1.close();
fos.close();
JOptionPane.showMessageDialog(null, "Image Successfully Retrieved");
} catch (Exception ex) {
System.out.println(ex);
}
}