Image editing issues

This is supposed to create a large image out of a smaller one.
It does this by:
Creating a temporary power of 2 image.
It grabs the pixels of the original image and pastes it into the PO2 temporary image.
Should work but it doesn’t. Anyone know why?

private BufferedImage convertToPO2(BufferedImage img) {
		BufferedImage tmpImg = null;
		tmpImg = new BufferedImage(img.getWidth() * 2, img.getHeight() * 2, BufferedImage.TYPE_INT_ARGB);
		
		double[] rPix = new double[img.getWidth() * img.getHeight() * 4];
		
		for (int i = 0; i < 4; i++) {
			rPix = img.getData().getSamples(0, 0, img.getWidth(), img.getHeight(), i, rPix);	
			tmpImg.getRaster().setSamples(0, 0, img.getWidth(), img.getHeight(), i, rPix);
		}
	
		
		return tmpImg;
	}

It would be easier to just draw img on tmpImg:
tmpImg.getGraphics().drawImage(img, …);

  1. I agree with tom

  2. Always specify how something doesn’t work, otherwise no one has a clue what’s going on.

Also, the output image will only be of power-of-two size if the input image is also power-of-two.
Maybe this is as intended, but in that case the method name could be said to be misleading…

The problem is that I cannot get an output image.
In other words the PO2 image isn’t displayed as in it’s as though I have an empty image.

Just fixed the problem.
I was looking in the wrong place.