}
BufferedImage destBufferedImage = new BufferedImage(destWidth,
destHeight, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics2D = destBufferedImage.createGraphics();
graphics2D.setBackground(Color.WHITE);
graphics2D.clearRect(0, 0, destWidth, destHeight);
graphics2D.drawImage(srcBufferedImage.getScaledInstance(imgWidth,
imgHeight, Image.SCALE_SMOOTH), (destWidth / 2)
- (imgWidth / 2), (destHeight / 2) - (imgHeight / 2), null);
graphics2D.dispose();
ImageIO.write(destBufferedImage, "JPEG", new File(destPath));