static L imagePixelsToRGBAWithSize_virtualIntList(BufferedImage etc img) { if (img == null) null; int w = img.getWidth(), h = img.getHeight(), n = w*h+2; ret new RandomAccessAbstractList() { public int size() { ret n; } public Int get(int i) { if (i == 0) ret w; if (i == 1) ret h; i -= 2; ret img.getRGB(i % w, i / h); } public Int set(int i, Int val) { if (i < 2) fail(); i -= 2; int old = img.getRGB(i % w, i / h); if (old != (int) val) img.setRGB(i % w, i / h, val); ret old; } }; // store width and height intToBytes_inArray_littleEndian(w, out, 0); intToBytes_inArray_littleEndian(h, out, 4); // store pixels copyIntArrayToByteArray_littleEndian(pixelsOfBufferedImage(img), out, 8); ret out; }