We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › smooth resizing of images
Page Index Toggle Pages: 1
smooth resizing of images (Read 2357 times)
smooth resizing of images
Apr 24th, 2005, 11:43pm
 
What would be the best way to go about bicubic or bilinear resizing of a PImage?
Re: smooth resizing of images
Reply #1 - Apr 25th, 2005, 4:30am
 
To make it larger or smaller, or just in general?
Re: smooth resizing of images
Reply #2 - Apr 25th, 2005, 3:20pm
 
PImage newbie = new PImage(newWidth, newHeight);
newbie.copy(original, 0, 0, original.width, original.height, 0, 0, newWidth, newHeight);
Re: smooth resizing of images
Reply #3 - Apr 25th, 2005, 4:40pm
 
Resizing in both directions.

Does copy() use use bicubic or bilinear interpolation?
Re: smooth resizing of images
Reply #4 - Apr 25th, 2005, 6:14pm
 
if image.smooth() has been set, it will use bilinear (that's the part that's toxi's code, so he can correct me if i'm wrong). you can set image.noSmooth() which will instead use nearest neighbor.

(edit) smooth should be set by default, so you should be getting bilinear with that.
Re: smooth resizing of images
Reply #5 - Apr 25th, 2005, 6:25pm
 
That's great. Thanks again fry.
Page Index Toggle Pages: 1