public void loadPixels() {
    if ((pixels == null) || (pixels.length != width * height)) {
      pixels = new int[width * height];
    }
    //((BufferedImage) image).getRGB(0, 0, width, height, pixels, 0, width);
    WritableRaster raster = ((BufferedImage) image).getRaster();
    raster.getDataElements(0, 0, width, height, pixels);
  }