我在数据库中存储了一些图像,同时检索它们,我想将其大小调整为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);
}
}