Results 1 to 3 of 3
Thread: BufferedImage: Uneven rescale
- 07-26-2008, 11:53 PM #1
Member
- Join Date
- Jul 2008
- Posts
- 1
- Rep Power
- 0
- 03-12-2009, 08:26 AM #2
Member
- Join Date
- Mar 2009
- Posts
- 13
- Rep Power
- 0
create a BufferedImage with the height you want get the graphics from it and draw the image you want to rescale on the graphics of the BufferedImage..
Image originalImage;
int scaledWidth = (int)(image.getWidth() *scaleFactorX);
int scaledHeight = (int)(image.getHeight() * ScaleFactorY);
BufferedImage bi = new BufferedImage(scaledWidth,scaledHeight,1);
Graphics2D g2 = (Graphics2D)bi.getGraphics();
g2.drawImage(originalImage, 0, 0, scaledWidth , scaledHeight , null);
try{
ImageIO.write(bi,"bmp",new File(out));
}catch(Exception e){
}
- 04-24-2009, 10:48 AM #3
Member
- Join Date
- Apr 2009
- Posts
- 10
- Rep Power
- 0
Similar Threads
-
How to convert between SWT Image and AWT BufferedImage
By Java Tip in forum SWTReplies: 0Last Post: 07-02-2008, 08:06 PM -
Convert Byte [] to BufferedImage
By Smily in forum Advanced JavaReplies: 3Last Post: 04-28-2008, 05:54 PM -
BufferedImage to Byte
By Java Tip in forum Java TipReplies: 0Last Post: 01-22-2008, 08:17 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks