public static void main(String args[]) { try { File f = new File(args[0]); int size = (int) f.length(); byte[] data = new byte[size]; FileInputStream fis = new FileInputStream(f); fis.read(data); fis.close(); PNGReader reader = new PNGReader(data); reader.read(); } catch (Throwable t) { t.printStackTrace(); } } }
/** * Gets the height of the image. Note that this is the height of the * underlying image, and does not take into account any size manipulations * that may have occurred when the image was added into Excel * * @return the image width in pixels */ public int getImageHeight() { return getPngReader().getHeight(); }
/** * Gets the width of the image. Note that this is the width of the * underlying image, and does not take into account any size manipulations * that may have occurred when the image was added into Excel * * @return the image width in pixels */ public int getImageWidth() { return getPngReader().getWidth(); }
/** * Gets the horizontal resolution of the image, if that information * is available. * * @return the number of dots per unit specified, if available, 0 otherwise */ public double getHorizontalResolution(LengthUnit unit) { int res = getPngReader().getHorizontalResolution(); return res / LengthConverter.getConversionFactor(LengthUnit.METRES, unit); }
/** * Gets the vertical resolution of the image, if that information * is available. * * @return the number of dots per unit specified, if available, 0 otherwise */ public double getVerticalResolution(LengthUnit unit) { int res = getPngReader().getVerticalResolution(); return res / LengthConverter.getConversionFactor(LengthUnit.METRES, unit); }
while (pos < pngData.length) int length = getInt(pngData[pos], pngData[pos+1], pngData[pos+2], pixelWidth = getInt(ihdrData[0], ihdrData[1], ihdrData[2], ihdrData[3]); pixelHeight = getInt(ihdrData[4], ihdrData[5], ihdrData[6], ihdrData[7]); horizontalResolution = getInt(physData[0], physData[1], physData[2], physData[3]); verticalResolution = getInt(physData[4], physData[5], physData[6], physData[7]);
/** * Gets the horizontal resolution of the image, if that information * is available. * * @return the number of dots per unit specified, if available, 0 otherwise */ public double getHorizontalResolution(LengthUnit unit) { int res = getPngReader().getHorizontalResolution(); return res / LengthConverter.getConversionFactor(LengthUnit.METRES, unit); }
/** * Gets the vertical resolution of the image, if that information * is available. * * @return the number of dots per unit specified, if available, 0 otherwise */ public double getVerticalResolution(LengthUnit unit) { int res = getPngReader().getVerticalResolution(); return res / LengthConverter.getConversionFactor(LengthUnit.METRES, unit); }
while (pos < pngData.length) int length = getInt(pngData[pos], pngData[pos+1], pngData[pos+2], pixelWidth = getInt(ihdrData[0], ihdrData[1], ihdrData[2], ihdrData[3]); pixelHeight = getInt(ihdrData[4], ihdrData[5], ihdrData[6], ihdrData[7]); horizontalResolution = getInt(physData[0], physData[1], physData[2], physData[3]); verticalResolution = getInt(physData[4], physData[5], physData[6], physData[7]);
public static void main(String args[]) { try { File f = new File(args[0]); int size = (int) f.length(); byte[] data = new byte[size]; FileInputStream fis = new FileInputStream(f); fis.read(data); fis.close(); PNGReader reader = new PNGReader(data); reader.read(); } catch (Throwable t) { t.printStackTrace(); } } }
/** * Gets the width of the image. Note that this is the width of the * underlying image, and does not take into account any size manipulations * that may have occurred when the image was added into Excel * * @return the image width in pixels */ public int getImageWidth() { return getPngReader().getWidth(); }
/** * Gets the height of the image. Note that this is the height of the * underlying image, and does not take into account any size manipulations * that may have occurred when the image was added into Excel * * @return the image width in pixels */ public int getImageHeight() { return getPngReader().getHeight(); }
private PNGReader getPngReader() { if (pngReader != null) { return pngReader; } byte[] imdata = null; if (origin == Origin.READ || origin == Origin.READ_WRITE) { imdata = getImageData(); } else { try { imdata = getImageBytes(); } catch (IOException e) { logger.warn("Could not read image file"); imdata = new byte[0]; } } pngReader = new PNGReader(imdata); pngReader.read(); return pngReader; }
private PNGReader getPngReader() { if (pngReader != null) { return pngReader; } byte[] imdata = null; if (origin == Origin.READ || origin == Origin.READ_WRITE) { imdata = getImageData(); } else { try { imdata = getImageBytes(); } catch (IOException e) { logger.warn("Could not read image file"); imdata = new byte[0]; } } pngReader = new PNGReader(imdata); pngReader.read(); return pngReader; }