ResampleOp resampleOp = new ResampleOp(with, height);
BufferedImage origImage;
try {
origImage = ImageIO.read(fileTarget);
String ext = FilenameUtils.getExtension(fileTarget.getName());
BufferedImage rescaledImage = resampleOp.filter(origImage, null);
ImageIO.write(rescaledImage, ext, fileTarget);
} catch (IOException rescaleEx) {
java.util.logging.Logger.getLogger(ResizeCommand.class.getName()).log(Level.SEVERE, null, rescaleEx);
}
} else if (mode.equals("crop")) {