上传者: lhhsyl
|
上传时间: 2021-11-05 10:50:52
|
文件大小: 2KB
|
文件类型: -
public static String getImageBinary(){
File f = new File("d://1.jpg");
BufferedImage bi;
try {
bi = ImageIO.read(f);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(bi, "jpg", baos);
byte[] bytes = baos.toByteArray();
return encoder.encodeBuffer(bytes).trim();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}