static Hi15Image hi15_imageMinusImage(Hi15Image img1, Hi15Image img2, double scale default 1) { assertSameSize(img1, img2); short[] pixels1 = img1.pixels, pixels2 = img2.pixels; int n = pixels1.length; short[] pixels3 = new[n]; double shift = 16; // gray = zero for i to n: { short p1 = pixels1[i], p2 = pixels2[i]; int r = iround((hi15_r(p1)-hi15_r(p2))*scale+shift); int g = iround((hi15_g(p1)-hi15_g(p2))*scale+shift); int b = iround((hi15_b(p1)-hi15_b(p2))*scale+shift); pixels3[i] = hi15_clamp(r, g, b); } ret new Hi15Image(img1.w(), img1.h(), pixels3); }