public BufferedImage getTiffImage(Map params) throws ImageReadException, IOException { if (null == tiffImageData) return null; return new TiffImageParser().getBufferedImage(this, params); }
public TiffImageMetadata getExifMetadata(ByteSource byteSource, Map params) throws ImageReadException, IOException { byte bytes[] = getExifRawData(byteSource); if (null == bytes) return null; if (params == null) params = new HashMap(); if (!params.containsKey(PARAM_KEY_READ_THUMBNAILS)) params.put(PARAM_KEY_READ_THUMBNAILS, Boolean.TRUE); return (TiffImageMetadata) new TiffImageParser().getMetadata(bytes, params); }
public FormatCompliance getFormatCompliance(ByteSource byteSource) throws ImageReadException, IOException { FormatCompliance formatCompliance = FormatCompliance.getDefault(); Map params = null; new TiffReader(isStrict(params)).readContents(byteSource, params, formatCompliance); return formatCompliance; }
BufferedImage result = getBufferedImageFactory(params) .getColorBufferedImage(width, height, hasAlpha); PhotometricInterpreter photometricInterpreter = getPhotometricInterpreter( directory, photometricInterpretation, bitsPerPixel, bitsPerSample, predictor, samplesPerPixel, width, height);
public static final ImageParser[] getAllImageParsers() { ImageParser result[] = { new JpegImageParser(), new TiffImageParser(), new PngImageParser(), new BmpImageParser(), new GifImageParser(), new PsdImageParser(), new PNMImageParser(), new IcoImageParser(), // new JBig2ImageParser(), // new TgaImageParser(), }; return result; }
ImageInfo imageData = getImageInfo(byteSource); if (imageData == null) return false;
public List collectRawImageData(ByteSource byteSource, Map params) throws ImageReadException, IOException { FormatCompliance formatCompliance = FormatCompliance.getDefault(); TiffContents contents = new TiffReader(isStrict(params)) .readDirectories(byteSource, true, formatCompliance); List result = new ArrayList(); for (int i = 0; i < contents.directories.size(); i++) { TiffDirectory directory = (TiffDirectory) contents.directories .get(i); List dataElements = directory.getTiffRawImageDataElements(); for (int j = 0; j < dataElements.size(); j++) { TiffDirectory.ImageDataElement element = (TiffDirectory.ImageDataElement) dataElements .get(j); byte bytes[] = byteSource.getBlock(element.offset, element.length); result.add(bytes); } } return result; }
BufferedImage result = getBufferedImageFactory(params) .getColorBufferedImage(width, height, hasAlpha); PhotometricInterpreter photometricInterpreter = getPhotometricInterpreter( directory, photometricInterpretation, bitsPerPixel, bitsPerSample, predictor, samplesPerPixel, width, height);
public static final ImageParser[] getAllImageParsers() { ImageParser result[] = { new JpegImageParser(), new TiffImageParser(), new PngImageParser(), new BmpImageParser(), new GifImageParser(), new PsdImageParser(), new PNMImageParser(), new IcoImageParser(), new IcnsImageParser(), // new JBig2ImageParser(), // new TgaImageParser(), }; return result; }
ImageInfo imageData = getImageInfo(byteSource); if (imageData == null) return false;
public byte[] getICCProfileBytes(ByteSource byteSource, Map params) throws ImageReadException, IOException { FormatCompliance formatCompliance = FormatCompliance.getDefault(); TiffContents contents = new TiffReader(isStrict(params)) .readFirstDirectory(byteSource, params, false, formatCompliance); TiffDirectory directory = (TiffDirectory) contents.directories.get(0); TiffField field = directory.findField(EXIF_TAG_ICC_PROFILE); if (null == field) return null; return field.oversizeValue; }
public BufferedImage getTiffImage(Map params) throws ImageReadException, IOException { if (null == tiffImageData) return null; return new TiffImageParser().getBufferedImage(this, params); }
public TiffImageMetadata getExifMetadata(ByteSource byteSource, Map params) throws ImageReadException, IOException { byte bytes[] = getExifRawData(byteSource); if (null == bytes) return null; if (params == null) params = new HashMap(); if (!params.containsKey(PARAM_KEY_READ_THUMBNAILS)) params.put(PARAM_KEY_READ_THUMBNAILS, Boolean.TRUE); return (TiffImageMetadata) new TiffImageParser().getMetadata(bytes, params); }
public List collectRawImageData(ByteSource byteSource, Map params) throws ImageReadException, IOException { FormatCompliance formatCompliance = FormatCompliance.getDefault(); TiffContents contents = new TiffReader(isStrict(params)) .readDirectories(byteSource, true, formatCompliance); List result = new ArrayList(); for (int i = 0; i < contents.directories.size(); i++) { TiffDirectory directory = (TiffDirectory) contents.directories .get(i); List dataElements = directory.getTiffRawImageDataElements(); for (int j = 0; j < dataElements.size(); j++) { TiffDirectory.ImageDataElement element = (TiffDirectory.ImageDataElement) dataElements .get(j); byte bytes[] = byteSource.getBlock(element.offset, element.length); result.add(bytes); } } return result; }
public FormatCompliance getFormatCompliance(ByteSource byteSource) throws ImageReadException, IOException { FormatCompliance formatCompliance = FormatCompliance.getDefault(); Map params = null; new TiffReader(isStrict(params)).readContents(byteSource, params, formatCompliance); return formatCompliance; }
public byte[] getICCProfileBytes(ByteSource byteSource, Map params) throws ImageReadException, IOException { FormatCompliance formatCompliance = FormatCompliance.getDefault(); TiffContents contents = new TiffReader(isStrict(params)) .readFirstDirectory(byteSource, params, false, formatCompliance); TiffDirectory directory = (TiffDirectory) contents.directories.get(0); TiffField field = directory.findField(EXIF_TAG_ICC_PROFILE); if (null == field) return null; return field.oversizeValue; }
public BufferedImage getBufferedImage(ByteSource byteSource, Map params) throws ImageReadException, IOException { FormatCompliance formatCompliance = FormatCompliance.getDefault(); TiffContents contents = new TiffReader(isStrict(params)) .readFirstDirectory(byteSource, params, true, formatCompliance); TiffDirectory directory = (TiffDirectory) contents.directories.get(0); BufferedImage result = directory.getTiffImage(params); if (null == result) throw new ImageReadException("TIFF does not contain an image."); return result; }
public BufferedImage getBufferedImage(ByteSource byteSource, Map params) throws ImageReadException, IOException { FormatCompliance formatCompliance = FormatCompliance.getDefault(); TiffContents contents = new TiffReader(isStrict(params)) .readFirstDirectory(byteSource, params, true, formatCompliance); TiffDirectory directory = (TiffDirectory) contents.directories.get(0); BufferedImage result = directory.getTiffImage(params); if (null == result) throw new ImageReadException("TIFF does not contain an image."); return result; }
public Dimension getImageSize(ByteSource byteSource, Map params) throws ImageReadException, IOException { FormatCompliance formatCompliance = FormatCompliance.getDefault(); TiffContents contents = new TiffReader(isStrict(params)) .readFirstDirectory(byteSource, params, false, formatCompliance); TiffDirectory directory = (TiffDirectory) contents.directories.get(0); int width = directory.findField(TIFF_TAG_IMAGE_WIDTH).getIntValue(); int height = directory.findField(TIFF_TAG_IMAGE_LENGTH).getIntValue(); return new Dimension(width, height); }
public String getXmpXml(ByteSource byteSource, Map params) throws ImageReadException, IOException { FormatCompliance formatCompliance = FormatCompliance.getDefault(); TiffContents contents = new TiffReader(isStrict(params)) .readDirectories(byteSource, false, formatCompliance); TiffDirectory directory = (TiffDirectory) contents.directories.get(0); TiffField xmpField = directory.findField(TIFF_TAG_XMP, false); if (xmpField == null) return null; byte bytes[] = xmpField.getByteArrayValue(); try { // segment data is UTF-8 encoded xml. String xml = new String(bytes, "utf-8"); return xml; } catch (UnsupportedEncodingException e) { throw new ImageReadException("Invalid JPEG XMP Segment."); } }