BufferedOutputStream bos = null;
try {
params.setLevels(ImageProcessingUtils.getLevelCount(bi.getWidth(), bi.getHeight()));
KduCompressExe encoder = new KduCompressExe();
bos = new BufferedOutputStream(os);
encoder.compressImage(bi, bos, params);
bos.close();
} catch (IOException details) {
LOGGER.error(details.getMessage(), details);
throw new FormatIOException(details.getMessage(), details);
} catch (DjatokaException details) {