/** * Writes a GrayImage to a file * * @param im the GrayImage */ public void write(GrayImage im) throws IOException { X = im.X(); Y = im.Y(); // convert to byte size GrayImage tmpim = (GrayImage) im.copy(); tmpim.byteSize(); // write PGM in raw format writeRawPGMHeader(X, Y); for (int y = 0; y < Y; y++) { for (int x = 0; x < X; x++) { data.write((byte) tmpim.get(x, y)); } } }
/** * Scales the range of <code>image</code> to an arbitrary min/max. * * @param image GrayImage to scale. * @return <code>image</code>. */ protected Image apply(GrayImage image) { return apply(image, new ROI(0, 0, image.X() - 1, image.Y() - 1)); }