Forums > Jitter

High-quality interpolation possible in Jitter?

Feb 09 2006 | 12:04 am

I’m having trouble with getting decent-quality interpolation when downscaling hi-res JPEGs and TIFFs (source is either full or cropped photo from 3000 x 2000 from Nikon D70 or approx. 5800 x 3700 from Nikon slide scanner) to a Jitter output that is arbitrarily smaller, such as 720 x 480 for DVD or 1024 x 768 for computer display. (For the sake of being complete, I’ll also say that there will also always be subsequent compositing operations with other downscaled photos or portions thereof.) I’m a Jitter newbie, but in my experiments with jit.matrix so far, turning on the interpolation option (per Jitter Tutorial 14) does little to eliminate the jaggies when scaling the image down to a smaller jit.matrix and subsequent jit.window. I seem to get the same results whether I use a "read" or "importmovie" command at the front end. I’ve just started to look into the GPU processing, but am still unclear what provision Jitter has under either CPU or GPU for smooth interpolation when downsizing large images… hopefully something approximating Photoshop’s interpolation capabilities (even if there’s a tradeoff in processing time).

Any thoughts are much appreciated!


Feb 09 2006 | 12:15 am

Your best bet is to do the downscaling in something like photoshop and
then bring it in to jitter.


Feb 09 2006 | 12:24 am

jit.matrix only exposes linear interpolation which doesn’t do much
for significant downsampling. We might expose something like cubic,
sinc, or mitchell filters in a later release. There are a few ways to
deal with this.

1. If appropriate, use an averaging downsample like this

#P outlet 49 268 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 49 226 74 196617 jit.op @op avg;
#P newex 49 153 74 196617 jit.op @op avg;
#P newex 49 189 164 196617 jit.demultiplex @demultiplexdim 1;
#P inlet 49 82 15 0;
#P newex 49 114 76 196617 jit.demultiplex;
#P window linecount 2;
#P comment 145 153 100 196617 4x averaging downsample;
#P connect 5 0 6 0;
#P connect 3 1 5 1;
#P connect 3 0 5 0;
#P connect 4 0 3 0;
#P connect 1 1 4 1;
#P connect 1 0 4 0;
#P connect 2 0 1 0;
#P window clipboard copycount 7;

2. Use the JS Image class for which we use a Mitchell filter for
scaling when interpolation is on. (note the fromnamedmatrix() and
tonamedmatrix() methods demonstrated in jsui_matriximage-example.pat)

3. Draw it in jit.lcd, since when downsampling QD uses a lanczos-sinc

4. Make clever use of jit.convolve to perform arbitrary filters.

Hope this helps somewhat.


Feb 09 2006 | 12:25 am

Thanks, Wes, but I’m hoping for a solution in Jitter… even if not as good as Photoshop, better than what I’m seeing so far with the interpolate attribute for jit.matrix. My project needs to randomly pull cropped areas of the hi-res photos and display them at lower res on the fly… and still look good enough that it doesn’t appear downsampled or jaggy.

Any other ideas out there?



Feb 09 2006 | 12:56 am

You may also be able to use some JAVA libraries if speed isn’t too
much of an issue. Other quick solutions might include running command
line image scaling operations that use GD (through PHP) or ImageMagick
which is quite nice for cammand line image processing.


Viewing 5 posts - 1 through 5 (of 5 total)

Forums > Jitter