if (image != null) {
// drop the alpha channel, if one exists
if (image.getColorModel().hasAlpha()) {
image = dropAlphaChannel(image);
}
return JpegImage.create(orientation.transform(Scalr.resize(image, Scalr.Method.AUTOMATIC, Scalr.Mode.AUTOMATIC, lengthOfLongestSideInPixels)));
}
}
catch (Exception e) {
final String message = "Exception while trying to create a thumbnail";
LOG.error(message, e);