Java BufferedImage Rotate rotate90ToRight(BufferedImage inputImage)

Here you can find the source of rotate90ToRight(BufferedImage inputImage)

Description

rotate an Image 90 Degrees to the Right

License

Apache License

Parameter

Parameter Description
inputImage a parameter

Return

the rotated image

Declaration

public static BufferedImage rotate90ToRight(BufferedImage inputImage) 

Method Source Code

//package com.java2s;
/**//from  w ww. jav a2  s  .  com
 * Copyright (c) 2013-2016 BITPlan GmbH
 *
 * http://www.bitplan.com
 *
 * This file is part of the Opensource project at:
 * https://github.com/BITPlan/com.bitplan.mjpegstreamer
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.awt.image.BufferedImage;

public class Main {
    /**
     * rotate an Image 90 Degrees to the Right
     * 
     * @param inputImage
     * @return the rotated  image
     */
    public static BufferedImage rotate90ToRight(BufferedImage inputImage) {
        int width = inputImage.getWidth();
        int height = inputImage.getHeight();
        BufferedImage returnImage = new BufferedImage(height, width,
                inputImage.getType());

        for (int x = 0; x < width; x++) {
            for (int y = 0; y < height; y++) {
                returnImage.setRGB(height - y - 1, x,
                        inputImage.getRGB(x, y));
            }
        }
        return returnImage;
    }
}

Related

  1. rotate(BufferedImage src)
  2. rotate(final BufferedImage image, final int angle)
  3. rotate(Graphics2D g, BufferedImage newImg, int x, int y, int width, int height, int angle, int originX, int originY)
  4. rotate90(BufferedImage bi)
  5. rotate90(BufferedImage img, boolean left)
  6. rotateAndFlipSwappingRowsAndColumns(BufferedImage srcImage)
  7. rotateBufferedImage(BufferedImage bufferedImage, double angle)
  8. rotateByRightAngle(BufferedImage source, int degrees)
  9. rotateFortyFiveClockwise(BufferedImage img)