Here you can find the source of drawImage(BufferedImage srcImg, BufferedImage img2Draw, int w, int h)
public static void drawImage(BufferedImage srcImg, BufferedImage img2Draw, int w, int h)
//package com.java2s; //License from project: Apache License import java.awt.Graphics2D; import java.awt.image.BufferedImage; public class Main { public static void drawImage(BufferedImage srcImg, BufferedImage img2Draw, int w, int h) { if (w == -1) w = (int) (srcImg.getWidth() / 2); if (h == -1) h = (int) (srcImg.getHeight() / 2); System.out.println("AWT Image Wt: " + w + " And Ht: " + h); Graphics2D g2 = srcImg.createGraphics(); g2.drawImage(img2Draw, w, h, null); g2.dispose();//from ww w.j a v a 2 s . com } }