Java 对图像进行90度旋转

2015-02-26 0 431
Java 对图像进行90度旋转
 
public BufferedImage rotate90DX(BufferedImage bi)
{
    int width = bi.getWidth();
    int height = bi.getHeight();
     
    BufferedImage biFlip = new BufferedImage(height, width, bi.getType());
     
    for(int i=0; i<width; i++)
        for(int j=0; j<height; j++)
            biFlip.setRGB(height-1-j, width-1-i, bi.getRGB(i, j));
     
    return biFlip;
}


public BufferedImage rotate90SX(BufferedImage bi)
{
    int width = bi.getWidth();
    int height = bi.getHeight();
     
    BufferedImage biFlip = new BufferedImage(height, width, bi.getType());
     
    for(int i=0; i<width; i++)
        for(int j=0; j<height; j++)
            biFlip.setRGB(j, i, bi.getRGB(i, j));
     
    return biFlip;
}
 

遇见资源网 java Java 对图像进行90度旋转 http://www.ox520.com/8634.html

下一篇: JDBC的工具类
常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务