I'm trying to resize an image using im4java. I haven't found any working examples and their JavaDocs are incomplete.
OOTB Java solutions are insufficient and lead to poor quality in the resulting images, despite rendering hint adjustments.
解决方案
First of all, im4java is an interface for imagemagick and/or graphicsmagick, so you need to install one of them on your computer to get im4java to work.
Here is the code to resize an image:
ConvertCmd cmd = new ConvertCmd();
IMOperation op = new IMOperation();
op.addImage("original_image.jpg");
op.resize(800,600);
op.addImage("resized_image.jpg");
cmd.run(op);