784013 wrote:<li> Use code tags as mentioned on the 'sticky post' at the top of the forum listing.
I use this code to resize a jpg picture. Sometimes i get the resized image but sometimes instead of the resized image i get a black image.
It is a web application so this code is within a servlet.
BufferedImage dimg = dimg = new BufferedImage(newW, newH, img.getType());
Also if for some reason your img.getType does not work--you'll get a black screen. I seem to remember back amoungst the cobwebs of my mind that GIF formats will sometimes produce strange results. Check your getType return value to see if it is a valid type or not.
BufferedImage dimg = new BufferedImage(newW, newH, img.getType());