private static BufferedImage resizeImage(BufferedImage originalImage, Dimension newImgSize) {
	int type = originalImage.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : originalImage.getType();
	BufferedImage resizedImage = new BufferedImage(newImgSize.width, newImgSize.height, type);
	Graphics2D g = resizedImage.createGraphics();
	g.drawImage(originalImage, 0, 0, newImgSize.width, newImgSize.height, null);
	g.dispose();
	return resizedImage;
    }