Java BufferedImage Operation knit(BufferedImage[] buffImages)

Here you can find the source of knit(BufferedImage[] buffImages)

Description

knit

License

Open Source License

Declaration

public static void knit(BufferedImage[] buffImages) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;

public class Main {
    private static int rows = 2;
    private static int cols = 2;

    public static void knit(BufferedImage[] buffImages) throws IOException {

        int chunkWidth, chunkHeight;
        int type;

        type = buffImages[0].getType();//from w  w  w. j a v a2  s. c  o  m
        chunkWidth = buffImages[0].getWidth();
        chunkHeight = buffImages[0].getHeight();

        //Initializing the final image  
        BufferedImage finalImg = new BufferedImage(chunkWidth * cols,
                chunkHeight * rows, type);

        int num = 0;
        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < cols; j++) {
                finalImg.createGraphics().drawImage(buffImages[num],
                        chunkWidth * j, chunkHeight * i, null);
                num++;
            }
        }
        System.out.println("Image concatenated.....");
        ImageIO.write(finalImg, "jpeg",
                new File(System.getProperty("user.dir")
                        + "/tmp/finalImg.jpg"));
    }
}

Related

  1. inColormap(float[][] in, float min, float max, float[][] colormap, BufferedImage b)
  2. indexToDirectColorModel(BufferedImage image)
  3. intBuffer2BufferedImage(IntBuffer ib, BufferedImage img)
  4. intensityArrayToBufferedImage(byte[] array, int w, int h)
  5. interp(BufferedImage img1, BufferedImage img2, int weight1, int weight2)
  6. layer(BufferedImage source, BufferedImage destination, int x, int y)
  7. makeBinary(BufferedImage image, int threshold)
  8. makeCursor(BufferedImage img, int hotx, int hoty, String name)
  9. makeGhost(BufferedImage image)