title: Get Image Width and Height in Java
body: <p>I just want to ask how to get the width and height of an image, because this returns -1 for width and height:</p>
  
  <pre><code>private void resizeImage(Image image){
      JLabel imageLabel = new JLabel();
  
      int imageWidth = image.getWidth(null);
      int imageHeight = image.getHeight(null);
      System.out.println("Width:" + imageWidth);
      System.out.println("Height:" + imageHeight);
  }
  </code></pre>