Here you can find the source of repairImage(final BufferedImage bfi, final List
public static BufferedImage repairImage(final BufferedImage bfi, final List<Integer> order) throws IOException
//package com.java2s; //License from project: Apache License import java.awt.Graphics; import java.awt.image.BufferedImage; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class Main { public static BufferedImage repairImage(final BufferedImage bfi, final List<Integer> order) throws IOException { final List<BufferedImage> list = new ArrayList<>(); final int width = bfi.getWidth(); for (int i = 0, k = width / 12; i < k; i++) { list.add(bfi.getSubimage(12 * i + 1, 0, 11, 58)); }//w ww. j a v a 2 s . com for (int i = 0, k = width / 12; i < k; i++) { list.add(bfi.getSubimage(12 * i + 1, 58, 11, 58)); } final List<BufferedImage> orderList = new ArrayList<>(); for (final int i : order) { orderList.add(list.get(i)); } final BufferedImage oriBfi = getOriPicture(orderList); // ImageIO.write(oriBfi, "png", new File("d://x.webp")); return oriBfi; } private static BufferedImage getOriPicture(final List<BufferedImage> orderList) { final BufferedImage bfi = new BufferedImage(260, 116, BufferedImage.TYPE_4BYTE_ABGR); final Graphics g = bfi.getGraphics(); for (int i = 0; i < 26; i++) { g.drawImage(orderList.get(i), i * 10, 0, null); } for (int i = 26; i < 52; i++) { g.drawImage(orderList.get(i), (i - 26) * 10, 58, null); } return bfi; } }