Java Utililty Methods BufferedImage Create

List of utility methods to do BufferedImage Create

Description

The list of methods to do BufferedImage Create are organized into topic(s).

Method

BufferedImagegetBufferedImageFromFile(String fileName)
get Buffered Image From File
return ImageIO.read(new File(fileName));
BufferedImagegetBufferedImageFromPath(String path)
Loads a BufferedImage from a given file path
BufferedImage image = null;
ImageInputStream is = ImageIO.createImageInputStream(new File(path));
Iterator<ImageReader> iter = ImageIO.getImageReaders(is);
ImageReader imageReader = (ImageReader) iter.next();
imageReader.setInput(is);
image = imageReader.read(0);
return image;
BufferedImagegetBufferedImageMixedImages(BufferedImage image1, BufferedImage image2, int xImage2, int yImage2)
Mezcla dos imagenes en una sola, sobreponiendo la segunda en la primera.
int w = Math.max(image1.getWidth(), image2.getWidth());
int h = Math.max(image1.getHeight(), image2.getHeight());
BufferedImage mixedImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
Graphics g = mixedImage.getGraphics();
g.drawImage(image1, 0, 0, null);
g.drawImage(image2, xImage2, yImage2, null);
return mixedImage;
intgetBufferedImageType(String encodeType)
get Buffered Image Type
if (encodeType.equals("png")) {
    return BufferedImage.TYPE_INT_ARGB;
} else {
    return BufferedImage.TYPE_INT_RGB;