Sent to me in a private message by gracedumbo:

Quote Originally Posted by gracedumbo
Start with this given to do backward mapping with bi-linear interpolation and Nearest Neighbor Interpolation ?thx a lot!
Java Code:
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.swing.*;
import java.util.*;
import java.lang.Math.*;
public class ImageProcessor
    public static BufferedImage convert(Image img)
        BufferedImage bi = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);
        Graphics bg = bi.getGraphics();
        bg.drawImage(img, 0, 0, null);
        return bi;
    public static BufferedImage imageScaling(Image img, double sX, double sY, int type)
    BufferedImage bufImg = convert(img);
        int width = bufImg.getWidth();
        int height = bufImg.getHeight();
        double newWidth = width * sX;
        double newHeight = height * sY;
        for(int j = 0; j < newHeight; j++)
            for(int i = 0; i < newWidth; i++)
        return bufImg;