Skip to main content

Scale Image without changing proportions

2 replies [Last post]
mabae
Offline
Joined: 2009-06-22

is there an easy way to scale an image with JAI (lets say 300*300) to (500*300) but wihtout losing quality or aspect ratio because of scaling (the image should be centered for example, leaving 100pixel top border and 100 pixel foot border.)

thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Vic Mortelmans

Check the border operation. Maybe using an overlay works as well (first
create the 500x300 canvas, then overlay the original image, which has to
be shifted first, I guess).

Groeten,
Vic

jai-interest@javadesktop.org wrote:
> is there an easy way to scale an image with JAI (lets say 300*300) to (500*300) but wihtout losing quality or aspect ratio because of scaling (the image should be centered for example, leaving 100pixel top border and 100 pixel foot border.)
>
> thanks
> [Message sent by forum member 'mabae' (mabae)]
>
> http://forums.java.net/jive/thread.jspa?messageID=352460
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net

Nidel, Mike

There's not a VERY easy way, like with a single operation. You have
to put the operations "scale" and "border" together yourself, and figure
out the right scale factor based on the target dimensions. At least this
is what I've done before in similar situations.

> -----Original Message-----
> From: jai-interest@javadesktop.org [mailto:jai-
> interest@javadesktop.org]
> Sent: Tuesday, June 23, 2009 3:32 AM
> To: interest@jai.dev.java.net
> Subject: [JAI] Scale Image without changing proportions
>
> is there an easy way to scale an image with JAI (lets say 300*300) to
> (500*300) but wihtout losing quality or aspect ratio because of scaling
> (the image should be centered for example, leaving 100pixel top border
> and 100 pixel foot border.)
>
> thanks
> [Message sent by forum member 'mabae' (mabae)]
>
> http://forums.java.net/jive/thread.jspa?messageID=352460
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net