// Get JAFFE database from http://www.kasrl.org/jaffe_info.html
// Extract pics in folder named "jaffe"
// package image_test;

import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

public class svq {

    public static void main(String[] args) {
        // read image
        BufferedImage input = null;
        try {
            input = ImageIO.read(new File("jaffe/KA.AN1.39.tiff.bmp"));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        // to byte array
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            ImageIO.write( input, "bmp", baos );
            baos.flush();
        } catch (IOException e) {

        }
        byte[] bytearray = baos.toByteArray();

        // to BufferedImage
        ByteArrayInputStream bais = new ByteArrayInputStream(bytearray);
        BufferedImage output = null;
        try {
            output = ImageIO.read(bais);
            bais.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        // save result
        try {
            ImageIO.write(output, "BMP", new File("test.bmp"));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        System.out.println("Done!");
    }
}
@@ -883,16 +883,337 @@
 ray();%0A%0A
+        // manipulation%0A        int height = input.getHeight();%0A        int width = input.getWidth();%0A        int pixel;%0A%0A        System.out.println(height + %22x%22 + width);%0A%0A        for (int i=5; i%3C4000; i++) %7B%0A            // bytearray%5Bi%5D = (byte)(bytearray%5Bi%5D+100%25255);%0A            bytearray%5Bi%5D = (byte)(255);%0A        %7D%0A%0A
         

Edit bytearray before saving - WIP