I am working on a small hobby project, in which i need to re-size my images to a fixed size of 180x230 pixels. To do that, I'm using the method below:
For some reason, my images are returning all blacked out, I have no idea why. But if I use my images without resizing them with this method, they are displayed correctly. Any hints or pointers on how I can fix this problem? any help would be greatly appreciated
Rich (BB code):
private Image scale(Image src) {
int w = 180;
int h = 230;
int type = BufferedImage.TYPE_INT_RGB;
BufferedImage dst = new BufferedImage(w, h, type);
Graphics2D g2 = dst.createGraphics();
g2.drawImage(src, 0, 0, w, h,null);
g2.dispose();
return (new ImageIcon(dst)).getImage();
}