code: protected BufferedImage rotate(double angle) {
          BufferedImage target = new BufferedImage(height, width, awt.getType());
          Graphics2D g2 = (Graphics2D) target.getGraphics();
          final int offsetx, offsety;
          if (angle < 0) {
              offsetx = 0;
              offsety = width;
          } else if (angle > 0) {
              offsetx = height;
              offsety = 0;
          } else {
              offsetx = 0;
              offsety = 0;
          }
          g2.translate(offsetx, offsety);
          g2.rotate(angle);
          g2.drawImage(awt, 0, 0, null);
          g2.dispose();
          return target;
      }
docs: Returns a new AWT Image rotated with the given angle (in degrees)