954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Rotation

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

freesoft_2000
Practically a Master Poster
623 posts since Jun 2004
Reputation Points: 25
Solved Threads: 10
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You