Package com.lightcrafts.image.metadata.values

Examples of com.lightcrafts.image.metadata.values.ImageMetaValue


    public ImageType getTrueImageTypeOf( ImageInfo imageInfo )
        throws BadImageFileException, IOException
    {
        try {
            final ImageMetadata metadata = imageInfo.getMetadata();
            final ImageMetaValue qualityValue =
                metadata.getValue( CanonDirectory.class, CANON_CS_QUALITY );
            if ( qualityValue == null )
                return null;
            if ( qualityValue.getIntValue() == CANON_CS_QUALITY_RAW ) {
                MetadataUtil.removePreviewMetadataFrom( metadata );
                MetadataUtil.removeWidthHeightFrom( metadata );
                return CanonTIFFRawImageType.INSTANCE;
            }
        }
View Full Code Here


        if ( tiffDir != null ) {
            for ( Iterator<Map.Entry<Integer,ImageMetaValue>>
                  i = tiffDir.iterator(); i.hasNext(); ) {
                final Map.Entry<Integer,ImageMetaValue> me = i.next();
                final int tagID = me.getKey();
                final ImageMetaValue value = me.getValue();
                switch ( tagID ) {
                    case TIFF_ARTIST:
                    case TIFF_COPYRIGHT:
                    case TIFF_DATE_TIME:
                    case TIFF_DOCUMENT_NAME:
                    case TIFF_HOST_COMPUTER:
                    case TIFF_IMAGE_DESCRIPTION:
                    case TIFF_INK_NAMES:
                    case TIFF_MAKE:
                    case TIFF_MODEL:
                    case TIFF_PAGE_NAME:
                    case TIFF_SOFTWARE:
                    case TIFF_TARGET_PRINTER:
                        setStringField( tagID, value.getStringValue() );
                        break;
                    case TIFF_MS_RATING:
                    case TIFF_RESOLUTION_UNIT:
                        setIntField( tagID, value.getIntValue() );
                        break;
                    case TIFF_X_RESOLUTION:
                    case TIFF_Y_RESOLUTION:
                        setFloatField( tagID, value.getFloatValue() );
                        break;
                }
            }
        }
View Full Code Here

            switch ( tagInfo.getType() ) {
                case META_UNDEFINED:
                case META_UNKNOWN:
                    continue;
            }
            final ImageMetaValue value = tagInfo.createValue();
            value.setIsChangeable( true );

            try {
                //
                // First, check to see if the element has an rdf:Alt or rdf:Seq
                // element as its child: if so, parse the sequence for multiple
                // values.
                //
                final Node child = XMLUtil.getFirstChildOf(
                    dirElement, m_rdfListElementFilter
                );
                if ( child != null )
                    value.setValues( readSeqList( (Element)child ) );
                else {
                    //
                    // Second, check to see if it has some other element(s) as
                    // its child(ren).  If so, parse them recursively.
                    //
                    final Node[] children =
                        XMLUtil.getChildrenOf( dirElement, dirPrefixFilter );
                    if ( children != null && children.length > 0 ) {
                        parseElements( children, dirPrefixFilter, dir );
                        continue;
                    }

                    //
                    // Lastly, see if its child is a text node.
                    //
                    final String text =
                        XMLUtil.getTextOfFirstTextChildOf( dirElement );
                    if ( text != null )
                        value.setValues( text.trim() );
                    else
                        value.setValues( "" );
                }

                dir.putValue( tagInfo.getID(), value );
            }
            catch ( Exception e ) {
View Full Code Here

                case META_UNDEFINED:
                case META_UNKNOWN:
                    continue;
            }
            try {
                final ImageMetaValue value = tagInfo.createValue();
                value.setIsChangeable( true );
                value.setValues( att.getValue() );
                dir.putValue( tagInfo.getID(), value );
            }
            catch ( Exception e ) {
                // ignore
            }
View Full Code Here

        final ImageMetadata metadata = imageInfo.getMetadata();
        final ImageMetadataDirectory tiffDir =
            metadata.getDirectoryFor( TIFFDirectory.class );
        if ( tiffDir == null )
            return null;
        final ImageMetaValue width = tiffDir.getValue( TIFF_IMAGE_WIDTH );
        final ImageMetaValue height = tiffDir.getValue( TIFF_IMAGE_LENGTH );
        return width != null && height != null ?
            new Dimension( width.getIntValue(), height.getIntValue() ) : null;
    }
View Full Code Here

     */
    public ICC_Profile getICCProfile( ImageInfo imageInfo )
        throws BadImageFileException, ColorProfileException, IOException,
               UnknownImageTypeException
    {
        final ImageMetaValue v = imageInfo.getMetadata().getValue(
            TIFFDirectory.class, TIFF_ICC_PROFILE
        );
        if ( v != null ) {
            final byte[] iccData = ((UndefinedMetaValue)v).getUndefinedValue();
            try {
View Full Code Here

        ImageInfo imageInfo, Class<? extends ImageMetadataDirectory> dirClass
    )
        throws BadImageFileException, IOException, UnknownImageTypeException
    {
        final ImageMetadata metadata = imageInfo.getMetadata();
        final ImageMetaValue xmpValue =
            metadata.getValue( dirClass, TIFF_XMP_PACKET );
        if ( xmpValue == null )
            return null;
        final byte[] xmpBytes = XMPUtil.getXMPDataFrom( xmpValue );
        if ( xmpBytes == null )
View Full Code Here

     */
    protected static Document getLZNDocumentImpl( ImageInfo imageInfo )
        throws BadImageFileException, IOException, UnknownImageTypeException
    {
        final ImageMetadata metadata = imageInfo.getMetadata();
        final ImageMetaValue lznValue =
            metadata.getValue( TIFFDirectory.class, TIFF_LIGHTZONE );
        if ( lznValue != null ) {
            final byte[] buf = ((ByteMetaValue)lznValue).getByteValues();
            final InputStream in = new ByteArrayInputStream( buf );
            return XMLUtil.readDocumentFrom( in );
        }
        //
        // For backwards compatibility, check for LightZone data inside XMP
        // metadata.
        //
        final ImageMetaValue xmpValue =
            metadata.getValue( TIFFDirectory.class, TIFF_XMP_PACKET );
        final byte[] xmp = XMPUtil.getXMPDataFrom( xmpValue );
        if ( xmp != null ) {
            final InputStream in = new ByteArrayInputStream( xmp );
            final Document xmpDoc = XMLUtil.readDocumentFrom( in );
View Full Code Here

     */
    private static RenderedImage getPhotoshopThumbnail( ImageInfo imageInfo )
        throws BadImageFileException, IOException, UnknownImageTypeException
    {
        final ImageMetadata metadata = imageInfo.getMetadata();
        final ImageMetaValue photoshop = metadata.getValue(
            TIFFDirectory.class, TIFF_PHOTOSHOP_IMAGE_RESOURCES
        );
        if ( photoshop == null )
            return null;
        final byte[] bytes = ((ByteMetaValue)photoshop).getByteValues();
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public float getAperture() {
        final ImageMetaValue value = getValue( CANON_SI_FNUMBER );
        return  value != null ?
                (float)MetadataUtil.convertFStopFromAPEX(
                    value.getIntValue()
                ) : 0;
    }
View Full Code Here

TOP

Related Classes of com.lightcrafts.image.metadata.values.ImageMetaValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.