atom feed2 messages in net.java.dev.jai-imageio.interestRescaling image to arbitrary sizes (w...
FromSent OnAttachments
Rafael SantosNov 5, 2007 12:32 pm 
Rafael SantosNov 5, 2007 12:35 pm 
Subject:Rescaling image to arbitrary sizes (without preserving aspect ratio)
From:Rafael Santos (rafa@lac.inpe.br)
Date:Nov 5, 2007 12:35:46 pm
List:net.java.dev.jai-imageio.interest

Hi, rajendraranabhat

I've changed the subject

Actually I didn't. Sorry. Don't drink and post. Here goes.

so people can see what the message is about. I'd also gather this is NOT related to ImageIO, but...

Hi i could scale the image with keeping the aspect ratio the same but i was thinking if we can scale the image by fixed height and width.For instance i have image of 120*100(width*height) and now i want it to make it some 80*90(width*height).Is it possible?For scaling the image with fixed ratio here goes my code.Sorry i am bit new to this JAI or Image IO:)

/* * This method rescales an image to 300,300 pixels using the JAI scale * operator. */ private RenderedImage rescale(RenderedImage i) { float baseSize = 300; float scaleW = ((float)baseSize)/i.getWidth(); float scaleH = ((float)baseSize)/i.getHeight(); // Scales the original image ParameterBlock pb = new ParameterBlock(); pb.addSource(i); pb.add(scaleW); pb.add(scaleH); pb.add(0.0F); pb.add(0.0F); pb.add(new InterpolationNearest()); // Creates a new, scaled image and uses it on the DisplayJAI component return JAI.create("scale", pb); }