Here you can find the source of linearResizeImage(BufferedImage origin, int width, int height)
public static BufferedImage linearResizeImage(BufferedImage origin, int width, int height)
//package com.java2s; //License from project: Apache License import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; public class Main { public static BufferedImage linearResizeImage(BufferedImage origin, int width, int height) { BufferedImage resizedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D g = resizedImage.createGraphics(); float xScale = (float) width / origin.getWidth(); float yScale = (float) height / origin.getHeight(); AffineTransform at = AffineTransform.getScaleInstance(xScale, yScale); g.drawRenderedImage(origin, at); g.dispose();//from w w w.j av a2 s. c om return resizedImage; } }