Код: Выделить всё
String fullImagePath = imageDiskPath + localIconUrl;
String extensionName = FilenameUtils.getExtension(localIconUrl);
BufferedImage img;
if("ico".equals(extensionName)){
img = Imaging.getAllBufferedImages(new File(fullImagePath)).get(0);
}else{
img = ImageIO.read(new File(fullImagePath));
}
if(img == null){
log.error("read image return home,url:" + fullImagePath);
return null;
}
ByteArrayOutputStream os = new ByteArrayOutputStream();
ImageIO.write(img, extensionName, os);
byte[] array = os.toByteArray();
if(ArrayUtils.isEmpty(array)){
log.error("array is null");
return null;
}

Я делаю неправильно? что мне следует сделать, чтобы он прочитал значок и успешно конвертировался в bas64? Я использую этот пакет для чтения значка:
Код: Выделить всё
api group: 'org.apache.commons', name: 'commons-imaging', version: '1.0-alpha2'
Код: Выделить всё
img = Imaging.getBufferedImage(new File(fullImagePath));
Подробнее здесь: https://stackoverflow.com/questions/678 ... 64-in-java
Мобильная версия