Here you can find the source of loadImageData(String name)
public static double[] loadImageData(String name)
//package com.java2s; //License from project: Apache License import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class Main { public static double[] loadImageData(String name) { BufferedImage bi = null;/*from w w w. jav a 2 s . c o m*/ double[] arr = null; try { File f = new File(name); bi = ImageIO.read(f); int w = bi.getWidth(null); int h = bi.getHeight(null); arr = new double[w * h]; System.out.println("w " + w + " : h " + h); bi.getRaster().getPixels(0, 0, w, h, arr); } catch (IOException e) { System.out.println("Image could not be read"); System.exit(1); } return arr; } }