List of utility methods to do BufferedImage Slice
BufferedImage[] | sliceImage(BufferedImage img, int cols, int rows) Split up an image into cols by rows tiles BufferedImage[] result = new BufferedImage[cols * rows]; int characterWidth = img.getWidth() / cols; int characterHeight = img.getHeight() / rows; int index = 0; for (int row = 0; row < rows; row++) { for (int col = 0; col < cols; col++, index++) { result[index] = new BufferedImage(characterWidth, characterHeight, img.getType()); Graphics2D g = result[index].createGraphics(); ... |
List | sliceImage(BufferedImage img, int verticalSize) slice Image List<Object[]> images = new ArrayList<>(); int start = 0; int end = verticalSize; int total = img.getHeight(); int slices = total / verticalSize + (total % verticalSize == 0 ? 0 : 1); for (int i = 0; i < slices; i++) { start = i * verticalSize; end = start + verticalSize - 1; ... |