I have created an image resizing class, with a crop method. The cropping works great, the issue that I am having is the background color that i specify in the drawImage function of Graphics is not working correctly, it defaults everything to black. Here is the code below that I am working with, I have also included the SaveTo method so you can see how I am saving as well
Try using BufferedImage.TYPE_INT_ARGB. The background is only used with transparency, and BufferedImage.TYPE_INT_RGB does not support that.
Also, there is an error in your code. You draw a part of the image of size OutputWidth x OutputHeight, but a part of that rectangle is outside your actual image. You should add SourceX and SourceY to the rectangle to draw:
Also, don't forget to dispose() your Graphics object.
So I dropped in TYPE_INT_ARGB in and it gave me the error "java.io.IOException: Image can not be encoded with compression type BI_RGB", after looking into that a bit, I set the "getImageWritersByFormatName" to use PNG instead of BMP (I guess BMP doesnt support transparency, or it does, but no one ever implements it). This time though the image that I am overlaying colors were modified and the background is still black : )
subject: Graphics.drawImage not using specified background color