/** * Obtains a sub-image of the specified image, whose upper-left corner is * given by (x, y). */ public BufferedImage openImage(int no, int x, int y, int w, int h) throws FormatException, IOException { Class dataType = getNativeDataType(); if (BufferedImage.class.isAssignableFrom(dataType)) { // native data type is compatible with BufferedImage return (BufferedImage) openPlane(no, x, y, w, h); } else { // must construct BufferedImage from byte array return AWTImageTools.openImage(openBytes(no, x, y, w, h), this, w, h); } }
/** * Obtains a sub-image of the specified image, whose upper-left corner is * given by (x, y). */ public BufferedImage openImage(int no, int x, int y, int w, int h) throws FormatException, IOException { Class dataType = getNativeDataType(); if (BufferedImage.class.isAssignableFrom(dataType)) { // native data type is compatible with BufferedImage return (BufferedImage) openPlane(no, x, y, w, h); } else { // must construct BufferedImage from byte array return AWTImageTools.openImage(openBytes(no, x, y, w, h), this, w, h); } }
/** Obtains a thumbnail for the specified image from the current file. */ public BufferedImage openThumbImage(int no) throws FormatException, IOException { Class dataType = getNativeDataType(); if (BufferedImage.class.isAssignableFrom(dataType)) { BufferedImage img = AWTImageTools.makeUnsigned(openImage(no)); return AWTImageTools.scale(img, getThumbSizeX(), getThumbSizeY(), false); } byte[] thumbBytes = openThumbBytes(no); return AWTImageTools.openImage(thumbBytes, this, getThumbSizeX(), getThumbSizeY()); }
/** Obtains a thumbnail for the specified image from the current file. */ public BufferedImage openThumbImage(int no) throws FormatException, IOException { Class dataType = getNativeDataType(); if (BufferedImage.class.isAssignableFrom(dataType)) { BufferedImage img = AWTImageTools.makeUnsigned(openImage(no)); return AWTImageTools.scale(img, getThumbSizeX(), getThumbSizeY(), false); } byte[] thumbBytes = openThumbBytes(no); return AWTImageTools.openImage(thumbBytes, this, getThumbSizeX(), getThumbSizeY()); }