// This reads a bma file, averages the three colors of each pixel, and writes a .jpg file. import java.awt.image.*; import javax.imageio.ImageIO; import java.io.*; class b2j1 { static int uv(byte b){return (255&(int)b);} static public void main(String[] args){ try { DataInputStream is = new DataInputStream(new FileInputStream(args[0])); int X = is.readInt(), Y = is.readInt(); System.out.println("X="+X+"Y="+Y); BufferedImage I = new BufferedImage(X, Y, BufferedImage.TYPE_BYTE_GRAY); WritableRaster wr = I.getRaster(); byte[] bc = new byte[3*X]; byte[] bcm = new byte[X]; for(int i = 0; i