ByteArrayOutputStream fileContent = StorageUtils.extractFileFromDoc(file);
if (fileContent.toByteArray().length==0) return new byte[]{};
String contentType = getContentType(file);
String ext = contentType.substring(contentType.indexOf("/")+1);
WritebleImageFormat format;
try{
format = WritebleImageFormat.valueOf(ext);
}catch (Exception e){
format= WritebleImageFormat.png;
}