Package com.lightcrafts.image.metadata.values

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


    /**
     * {@inheritDoc}
     */
    public String getArtist() {
        final ImageMetaValue value = getValue( IPTC_CREATOR );
        return value != null ? value.getStringValue() : null;
    }
View Full Code Here


    /**
     * {@inheritDoc}
     */
    public Date getCaptureDateTime() {
        final ImageMetaValue value = getValue( IPTC_DATE_CREATED );
        return  value instanceof DateMetaValue ?
                ((DateMetaValue)value).getDateValue() : null;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public String getCopyright() {
        final ImageMetaValue value = getValue( IPTC_COPYRIGHT_NOTICE );
        return value != null ? value.getStringValue() : null;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public String getTitle() {
        final ImageMetaValue value = getValue( IPTC_OBJECT_NAME );
        return value != null ? value.getStringValue() : null;
    }
View Full Code Here

        //
        for ( Iterator<Map.Entry<Integer,ImageMetaValue>> i = iterator();
              i.hasNext(); ) {
            final Map.Entry<Integer,ImageMetaValue> me = i.next();
            final int tagID = me.getKey();
            ImageMetaValue value = me.getValue();

            //
            // Only these tags are encoded as part of IPTC for XMP Core.
            //
            switch ( tagID ) {
                case IPTC_COUNTRY_CODE:
                case IPTC_INTELLECTUAL_GENRE:
                case IPTC_LOCATION:
                case IPTC_SCENE:
                case IPTC_SUBJECT_CODE:
                    break;
                default:
                    if ( !tagIsCreatorContactInfo( tagID ) )
                        continue;
            }

/*
            //
            // In XMP, IPTC time fields are merged into the corresponding date
            // field.
            //
            switch ( tagID ) {
                case IPTC_DATE_CREATED:
                    value = mergeDateTime( value, IPTC_TIME_CREATED );
                    break;
                case IPTC_DATE_SENT:
                    value = mergeDateTime( value, IPTC_TIME_SENT );
                    break;
                case IPTC_DIGITAL_CREATION_DATE:
                    value = mergeDateTime( value, IPTC_DIGITAL_CREATION_TIME );
                    break;
                case IPTC_EXPIRATION_DATE:
                    value = mergeDateTime( value, IPTC_EXPIRATION_TIME );
                    break;
                case IPTC_RELEASE_DATE:
                    value = mergeDateTime( value, IPTC_RELEASE_TIME );
                    break;
                case IPTC_DIGITAL_CREATION_TIME:
                case IPTC_EXPIRATION_TIME:
                case IPTC_RELEASE_TIME:
                case IPTC_TIME_CREATED:
                case IPTC_TIME_SENT:
                    continue;
            }

*/
            final Element valueElement = value.toXMP( xmpDoc, nsURI, prefix );
            if ( valueElement != null ) {
                final Element parent;
                if ( tagIsCreatorContactInfo( tagID ) )
                    parent = cciElement;
                else {
View Full Code Here

    private int calcEncodedIPTCSize() {
        int size = 0;
        for ( Iterator<Map.Entry<Integer,ImageMetaValue>> i = iterator();
              i.hasNext(); ) {
            final Map.Entry<Integer,ImageMetaValue> me = i.next();
            final ImageMetaValue imValue = me.getValue();
            switch ( imValue.getType() ) {
                case META_SBYTE:
                case META_UBYTE:
                    size += IPTC_ENTRY_HEADER_SIZE + 1;
                    break;
                case META_DATE:
                    size += IPTC_ENTRY_HEADER_SIZE + IPTC_DATE_SIZE;
                    break;
                case META_SSHORT:
                case META_USHORT:
                    size += IPTC_ENTRY_HEADER_SIZE + IPTC_SHORT_SIZE;
                    break;
                case META_STRING:
                    for ( String s : imValue.getValues() ) {
                        try {
                            final byte[] b = s.getBytes( "ISO-8859-1" );
                            size += IPTC_ENTRY_HEADER_SIZE + b.length;
                        }
                        catch ( UnsupportedEncodingException e ) {
View Full Code Here

                //
                // Non-IIM tags can't be encoded into binary form.
                //
                continue;
            }
            final ImageMetaValue imValue = getValue( tagID );
            switch ( imValue.getType() ) {
                case META_SBYTE:
                case META_UBYTE: {
                    encodeTag( buf, tagID );
                    buf.putShort( (short)1 );
                    buf.put( imValue.getStringValue().getBytes()[0] );
                    break;
                }
                case META_DATE: {
                    encodeTag( buf, tagID );
                    String date = imValue.getStringValue();
                    date =  date.substring( 0, 4 ) +    // YYYY
                            date.substring( 5, 7 ) +    // MM
                            date.substring( 8, 10 );    // DD
                    encodeString( buf, date );
                    break;
                }
                case META_SSHORT:
                case META_USHORT: {
                    encodeTag( buf, tagID );
                    buf.putShort( (short)2 );
                    buf.putShort( imValue.getShortValue() );
                    break;
                }
                case META_STRING: {
                    for ( String s : imValue.getValues() ) {
                        encodeTag( buf, tagID );
                        encodeString( buf, s );
                    }
                    break;
                }
View Full Code Here

     * time values.)
     * @return Returns a new {@link DateMetaValue} that is the date of the old
     * {@link DateMetaValue} plus the time.
     */
    private ImageMetaValue mergeDateTime( ImageMetaValue date, int timeTagID ) {
        final ImageMetaValue timeValue = getValue( timeTagID );
        if ( timeValue == null )
            return date;
        final String timeString = timeValue.getStringValue();
        if ( timeString.length() != 11 )
            return date;

        try {
            final int hh = Integer.parseInt( timeString.substring( 0, 2 ) );
View Full Code Here

        setIcon(Icon);

        ImageMetadataDirectory coreDir =
            meta.getDirectoryFor(CoreDirectory.class);

        ImageMetaValue fileValue =
            coreDir.getValue(CORE_FILE_NAME);
        ImageMetaValue dirValue =
            coreDir.getValue(CORE_DIR_NAME);

        imageFile = new File(dirValue.toString(), fileValue.toString());

        updateFromDatabase();

        DocumentDatabase.addListener(this);
    }
View Full Code Here

    }

    public RatingObject getValue(ImageMetadata meta) {
        ImageMetadataDirectory dir = meta.getDirectoryFor(clazz);
        if (dir != null) {
            ImageMetaValue value = dir.getValue(tagID);
            return new RatingObject(value);
        }
        return new RatingObject(null);
    }
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.