public BufferedImage imageFit(JLabel label, String path){
        BufferedImage bi = null;
        try {
            bi=new BufferedImage(label.getWidth(),label.getHeight(),BufferedImage.TYPE_INT_RGB);
            Graphics2D g=bi.createGraphics();            
            Image img=ImageIO.read(new File(path));            
            g.drawImage(img, 0, 0, label.getWidth(),label.getHeight(), null);            
            g.dispose();            
        } catch (IOException ex) {}
        return bi;
    }