Results 1 to 3 of 3
  1. #1
    MINGxDOG is offline Member
    Join Date
    Nov 2009
    Posts
    4
    Rep Power
    0

    Default BufferedImage imageScaling

    Start with this given part..how to do backward mapping with bi-linear interpolation and Nearest Neighbor Interpolation ?


    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);
    		bg.dispose();
    		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;
    
    	}
    }
    Last edited by MINGxDOG; 11-17-2009 at 03:03 PM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

  3. #3
    MINGxDOG is offline Member
    Join Date
    Nov 2009
    Posts
    4
    Rep Power
    0

Similar Threads

  1. BufferedImage through FTP
    By dudejonne in forum New To Java
    Replies: 7
    Last Post: 11-05-2009, 05:36 PM
  2. BufferedImage: Uneven rescale
    By legsmacgee in forum Java 2D
    Replies: 2
    Last Post: 04-24-2009, 10:48 AM
  3. Replies: 0
    Last Post: 07-02-2008, 08:06 PM
  4. Convert Byte [] to BufferedImage
    By Smily in forum Advanced Java
    Replies: 3
    Last Post: 04-28-2008, 05:54 PM
  5. BufferedImage to Byte
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-22-2008, 08:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •