Java BufferedImage Rotate rotateImage180(BufferedImage image, final int bufferedImageType)

Here you can find the source of rotateImage180(BufferedImage image, final int bufferedImageType)

Description

rotate Image

License

Open Source License

Declaration

public static BufferedImage rotateImage180(BufferedImage image, final int bufferedImageType) 

Method Source Code

//package com.java2s;
/*/*from   w  w w  .ja v  a 2s.  co m*/
 * Copyright 2000-2013 Enonic AS
 * http://www.enonic.com/license
 */

import java.awt.image.BufferedImage;

public class Main {
    public static BufferedImage rotateImage180(BufferedImage image, final int bufferedImageType) {
        return rotateImage90(rotateImage90(image, bufferedImageType), bufferedImageType);
    }

    public static BufferedImage rotateImage90(BufferedImage image, final int bufferedImageType) {
        int width = image.getWidth();
        int height = image.getHeight();
        BufferedImage destImage = new BufferedImage(height, width, bufferedImageType);

        for (int i = 0; i < width; i++) {
            for (int j = 0; j < height; j++) {
                destImage.setRGB(height - 1 - j, i, image.getRGB(i, j));
            }
        }

        return destImage;
    }
}

Related

  1. rotateImage(BufferedImage img, double degree)
  2. rotateImage(BufferedImage src, double degrees)
  3. rotateImage(final BufferedImage image, final double theta)
  4. rotateImage(final BufferedImage savedImage, final int angle)
  5. rotateImage(final BufferedImage src, final double degrees)
  6. rotateImageLeft90( BufferedImage bufferedimage)
  7. rotateImageRect(final BufferedImage image, final int degrees)
  8. rotateImages(BufferedImage imgs[], double angle)
  9. RotateLeft(BufferedImage bi)