title: Java Image Cut Off
body: <p>Same question as last time but I will provide more detail. 
  I am currently rotating images using:</p>
  
  <pre><code> int rotateNum //in main class
  
   double rotationRequired = Math.toRadians(rotateNum);
  
      double locationX = img.getWidth(this) / 2;
      double locationY = img.getHeight(this) / 2;
      AffineTransform tx = AffineTransform.getRotateInstance(rotationRequired, locationX, locationY);
      AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR);
  
  
      g2d.drawImage(op.filter((BufferedImage)img, null), imgX, imgY, null);
  </code></pre>
  
  <p>And then I am actually rotating the image using:</p>
  
  <pre><code>double deltaX = (double)(imgY - otherImg.imgY);
  double deltaY = (double)(imgX - otherImg.imgX);
  rotateNum = (int)(180 * Math.atan2(deltaY, deltaX) / Math.PI);
  </code></pre>
  
  <p>My images vary in size. The smaller images don't get cut off (meaning cut off with white space) but the larger ones do, on the left or right side. Resizing the images doesn't work, and I clipped out the white rectangle around the image using the
   GIMP.</p>
  
  <p>Example Images:
  Before(ignore the grey area to the left)
  <img src="https://i.stack.imgur.com/ZedTG.png" alt=""></p>
  
  <p>After:
  See the cutoff at the side
  <img src="https://i.stack.imgur.com/zt584.png" alt=""></p>