Here you can find the source of findTranslation(AffineTransform at, BufferedImage bi)
private static AffineTransform findTranslation(AffineTransform at, BufferedImage bi)
//package com.java2s; //License from project: Apache License import java.awt.geom.AffineTransform; import java.awt.geom.Point2D; import java.awt.image.BufferedImage; public class Main { private static AffineTransform findTranslation(AffineTransform at, BufferedImage bi) { Point2D p2din, p2dout;//from ww w .j a v a2s. c o m p2din = new Point2D.Double(0.0, 0.0); p2dout = at.transform(p2din, null); double ytrans = p2dout.getY(); p2din = new Point2D.Double(0, bi.getHeight()); p2dout = at.transform(p2din, null); double xtrans = p2dout.getX(); AffineTransform tat = new AffineTransform(); tat.translate(-xtrans, -ytrans); return tat; } }