Is it possible to implement the first example with Scalr?
My code is the following:
BufferedImage thumbnail = Scalr.resize(ImageIO.read(sourceFile), Scalr.Method.ULTRA_QUALITY, Scalr.Mode.FIT_TO_WIDTH,
width, height, Scalr.OP_ANTIALIAS);
ImageIO.write(thumbnail, destinationfile.getExtension(), destinationfile);
What I want is to receive the image like this:
where the blue bars are the space I want to fill with the color.
Thank you
Update: maybe it is possible to implement with Thumbnailator?
Nobody has idea so I will publish my solution... I decided to continue to use Scalr (I didn't checked the Thumbnailator's last version but the previous ones failed on big pictures). So first of all I call
resizemethod, and then, if sizes of the new thumbnail are bigger then given ones I callcropmethod that crops a thumbnail by the center.. The code is the following:It is not ideal, but at least it handles 'wide' images after generation of thumbnails