java实现图片水平翻转

private static BufferedImage flipImage(final BufferedImage bufferedimage) {
int imageWidth = bufferedimage.getWidth();
int imageHeight = bufferedimage.getHeight();

BufferedImage img = null;
Graphics2D graphics2d = null;

try {
(graphics2d = (img = new BufferedImage(imageWidth, imageHeight, bufferedimage
.getColorModel().getTransparency())).createGraphics())
.drawImage(bufferedimage, 0, 0, imageWidth, imageHeight, imageWidth, 0, 0, imageHeight, null);
} catch (Exception e) {
F2Logger.getLogger().log(PhotoConstants.EFUP0003, new Object[] { e.getMessage() });
throw e;
} finally {
graphics2d.dispose();
}

return img;
}

你可能感兴趣的:(java实现图片水平翻转)