Here you can find the source of declareNewBufferedImage(int x, int y)
public static BufferedImage declareNewBufferedImage(int x, int y)
//package com.java2s; //License from project: Open Source License import java.awt.image.BufferedImage; import javax.imageio.ImageTypeSpecifier; public class Main { public static BufferedImage declareNewBufferedImage(int x, int y) { //naredi novo prazno sliko zeljene velikosti BufferedImage imgOut = new BufferedImage(x, y, BufferedImage.TYPE_INT_RGB); return imgOut; }//from ww w. java 2 s. c o m public static BufferedImage declareNewBufferedImage(BufferedImage img) { //naredi novo prazno sliko enake velikosti //kot jo ima tista, ki jo podamo kot argument ImageTypeSpecifier its = new ImageTypeSpecifier(img); BufferedImage imgOut = new BufferedImage(img.getWidth(), img.getHeight(), its.getBufferedImageType()); return imgOut; } public static BufferedImage declareNewBufferedImage(BufferedImage img1, BufferedImage img2) { int h1 = img1.getHeight(); int w1 = img1.getWidth(); int h2 = img2.getHeight(); int w2 = img2.getWidth(); int height = (h1 < h2) ? h1 : h2; int width = (w1 < w2) ? w1 : w2; //uzame sirino od ozje slike in visino od nizje //taksnih dimenzij je potem izhodna slika ImageTypeSpecifier its = new ImageTypeSpecifier(img1); BufferedImage imgOut = new BufferedImage(width, height, its.getBufferedImageType()); return imgOut; } }