title: scale image with Java
body: <p>I want to make an image smaller using the following java code. The original image is show on the screen (height larger than maxHeight). Why?</p>
  
  <pre><code>try{
  
          final int maxHeight = 600;
          JLabel picLabel;
          BufferedImage myPicture = ImageIO.read(new File("src/VIZ/"+listOfFiles[1].getName()));
          int height = myPicture.getHeight();
          int width = myPicture.getWidth();
          if ( height &lt; maxHeight ){
              int multiplier = height/maxHeight;
              height = maxHeight;
              int newWidth = width/multiplier;
              BufferedImage bi = new BufferedImage(newWidth, maxHeight, BufferedImage.TYPE_INT_ARGB);
              picLabel = new JLabel(new ImageIcon( bi ));
          }else{
          picLabel = new JLabel(new ImageIcon( myPicture ));
          }
  
  
          console.add(picLabel);
      }
  
      catch(Exception e){
  
      }
  </code></pre>