Hi Alain,
I think your method is ok so your problem is probably to do with the bufferedimage you are passing to it. The image is probably black because the buffedimage you're writing is an empty buffer. What are you using to read in the image? Before changing to using the new ImageIO I used ImageIcon:
Image inImage = new ImageIcon(u).getImage();
You may also need to wait for the image to fully download, ie use media tracker (I've never used this, but here's some code):
MediaTracker mediaTracker = new MediaTracker(null);
mediaTracker.addImage(image, 0);
mediaTracker.waitForID(0);
Hope that helps
Brendan