try {
BufferedImage img = ImageIO.read(new File("thumb_G_1493825124502.png"));
float xscale = (float)(w_img)/(float)(img.getWidth());
float yscale = (float)(h_img)/(float)(img.getHeight());
System.out.println("x:"+xscale+" y:"+yscale+" w_img:"+w_img+" h_img:"+h_img+" iw:"+img.getWidth()+" ih:"+img.getHeight());
AffineTransform at = new AffineTransform();
at.scale(xscale, yscale);
BufferedImageOp bio = new AffineTransformOp(at,AffineTransformOp.TYPE_BILINEAR);
BufferedImage biDst = bio.filter(img, null);
g2d.drawImage(img, bio, x_img, y_img);
} catch (IOException e)
{
e.printStackTrace();
}