freesoft_2000 9 Practically a Master Poster

Hi everyone,

I am trying to rotate a jpeg image but it seems that the image gets clipped and there seems to be an ugly black rectangle drawn behind the image after it has been rotated by me. I am really not very sure what i am doind wrong.

Here is the function that is responsible for the image rotation

public BufferedImage imagerotate(BufferedImage SourceImage3, double Degrees1)
{
AffineTransform AT1 = new AffineTransform();
BufferedImage Image5;
int width, height;
double Radians1;
Radians1 = Math.toRadians(Degrees1);
width = (int)(SourceImage3.getWidth());
height = (int)(SourceImage3.getHeight());
Image5 = new BufferedImage(width, height, SourceImage3.getType());
Graphics2D g2 = (Graphics2D)Image5.getGraphics();
AT1.rotate(Radians1);
g2.drawImage(SourceImage3, AT1, null);
return Image5;
}

What i need is for the image not to clipped in anyway and there not to be an ugly black rectangle behind the image after the rotation has taken place.

I hope someone can help me with this

Thank You

Yours Sincerely

Richard West

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.