title: Work out the maximum size of an image?
body: <p>I am creating a little game in Java and I have an image which gets rotated.</p>
  
  <p><img src="https://i.stack.imgur.com/kygjE.png" alt="enter image description here"></p>
  
  <p>As you can see in the two images below, there is a giant ship which slowly rotates in the game, but when it gets to a certain point it gets cut off (due to its own little BufferedImage).</p>
  
  <p>Heres my rendering code:</p>
  
  <pre><code>public void drawImageRotated(BufferedImage img, double x, double y, double scale,    double angle) {
          x -= xScroll;
          y -= yScroll;  
          BufferedImage image = new BufferedImage((int)(img.getWidth() * 1.5D), (int)(img.getHeight() * 1.5D), 2);
          Graphics2D g = (Graphics2D)image.getGraphics();
          g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
          g.rotate(Math.toRadians(angle), image.getWidth() / 2, image.getHeight() / 2);
          g.drawImage(img, image.getWidth() / 2 - img.getWidth() / 2, image.getHeight() / 2 - image.getHeight() / 2, null);
          g2d.drawImage(image, (int)(x-image.getWidth()*scale/2), (int)(y-image.getHeight()*scale/2), (int)(image.getWidth()*scale), (int)(image.getHeight()*scale), null);
          g.dispose();      
   }
  </code></pre>
  
  <p>Back to the matter at hand, how can i work out the maximum x and y size of an image during rotation so I can compensate with my buffered images size?</p>