Java BufferedImage Operation declareNewBufferedImage(int x, int y)

Here you can find the source of declareNewBufferedImage(int x, int y)

Description

declare New Buffered Image

License

Open Source License

Declaration

public static BufferedImage declareNewBufferedImage(int x, int y) 

Method Source Code

//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;
    }
}

Related

  1. contrast(BufferedImage src, float scaleFactor)
  2. criarImagemCompativel(BufferedImage original, int largura, int altura, boolean manterQualidade)
  3. cutToSquare(BufferedImage src)
  4. cylindricalMapping(BufferedImage img, double f)
  5. darkenImage(final BufferedImage image, final float darken)
  6. declareNewBufferedImageAndCopy(BufferedImage img)
  7. depalettize(BufferedImage img, int maxBytes)
  8. determineBackgroundColor(BufferedImage bim)
  9. doInGraphics(final BufferedImage image, final Consumer consumer)