package dq6_unscrambler; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import java.awt.Graphics2D; import java.awt.image.BufferedImage; public class Main { public static void main(String[] args) { File inFile = new File("in.png"); BufferedImage in = null; try { in = ImageIO.read(inFile); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } File outFile = new File("out.png"); BufferedImage oldOut = null; try { oldOut = ImageIO.read(outFile); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } BufferedImage out = new BufferedImage(128, oldOut.getHeight() + 24, 1); Graphics2D g = out.createGraphics(); g.drawImage(oldOut, 0, 0, null); int y0 = oldOut.getHeight(); for (int tile = 0; tile < 48; tile++) { int dx = (tile / 3) * 8; int dy = y0 + (tile % 3) * 8; int sx = (tile % 16) * 8; int sy = (tile / 16) * 8; g.drawImage(in, dx, dy, dx + 8, dy + 8, sx, sy, sx + 8, sy + 8, null); } try { ImageIO.write(out, "png", outFile); } catch (IOException e) { e.printStackTrace(); } } }