An ImageJ plugin to resize an image using high-quality interpolation
Courtesy of Image Compression
This plugin changes the size of an image to any dimension using either interpolation (the standard method used for example in Photoshop), or least-squares approximation (our new high-quality approach). The size of the output image is specified in pixels or as a percentage of the input size. The default settings preserve the aspect ratio. The user can also select between two spline degrees for the image: piecewise linear or cubic spline (higher quality).
 A. Muñoz Barrutia, T. Blu, M. Unser, "Least-Squares Image Resizing Using Finite Differences," IEEE Transactions on Image Processing, vol. 10, no. 9, pp. 1365-1378, September 2001.
The plugin implements two different resizing methods: standard resizing using interpolation, and high-quality resizing based on least-squares approximation. Both of them use a continuously defined B-spline model to represent the images.
The standard method for size reduction or enlargement is to fit the pixels with a continuous model and to resample the function at the desired rate. In the case of image reduction, the creation of aliasing is the major problem of this approach. Blocking or smoothing artifacts may also be introduced when low-order models are used.
These undesired effects are reduced if we approximate the continuous model by its least-squares projection onto a given space prior to resampling. This new approach is a generalized version of the anti-aliasing filtering operation. It is optimal in the case of image reduction. It can accomodate any arbitrary (non-necessarily rational) scaling factor. When the scale parameter is an integer power of 2, our approach is equivalent to wavelet processing because splines satisfy a two-scale relation. The boundary conditions are mirror-symmetric.
The software provided here is a plugin for ImageJ, a general purpose image-processing and image-analysis package. ImageJ has a public domain licence; it runs on several plateforms: Unix, Linux, Windows, Mac OS 9 and Mac OS X. It doesn't take more than a couple of minutes to install.
Download and install
Download Resize_.jar, the ImageJ's plugin. The plugin consists in one single JAR file; place it into the "plugins" folder of ImageJ. Do not unzip the JAR file.
Call from a macro
Download Resize.zip and unzip it. Put the class files in the ImageJ's plugins" folder of ImageJ. To learn the name of the parameters, run first the Resize (or Resize Expert) by activating the Macro Recorder of ImageJ.
// Example of Resize called from a macro run("Resize ", "sizex=181.0 sizey=144.0 method=Least-Squares interpolation=Cubic unitpixelx=true unitpixely=true"); // Example of Resize Expert called from a macro run("ResizeExpert ", "interpolationdegree=1 analysisdegree=0 synthesisdegree=0 zoomx=0.65 zoomy=2.5 shiftx=0 shifty=0 method= inversable=false");
Conditions of use
You'll be free to use this software for research purposes, but you must not transmit and distribute it without our consent. In addition, you undertake to include a citation whenever you present or publish results that are based on it. EPFL makes no warranties of any kind on this software and shall in no event be liable for damages of any kind in connection with the use and exploitation of this technology.
We have also a demonstration of this algorithm running on any browser that supports Java.