RE: [sanselan] EXIF_TAG_MODIFY_DATE removed from new imaging package?

2012-04-26 Thread Gary Lucas
Excellent idea.  Thanks.

Our application uses a modified version of Sanselan that includes my 
performance enhancements.  I've started swapping that out with the latest from 
Apache Imaging, again with my latest two patches for speed improvements.   On 
the read side, it went very quickly.   On the write side, I'm still trying to 
get things working. Although the API is definitely a lot cleaner than the 
original, I'm not sure I've figured it out yet.

Here's a snippet of code I'm using to write a GeoTIFF file.   Would you take a 
look and make sure I am doing the right thing (particularly in the constructor 
for the TiffOutputDirectory)?  The fieldList is a set of output fields that 
were populated by a utility routine.   That approach is a hold-over from the 
Sanselan implementation (is there a better way to do it?).   I add them to an 
output directory, bundle the directory in an output set, and pass the output 
set into the lossy writer as a parameter.




HashMapString, Object params = new HashMapString, Object();

// set optional parameters if you like
params.put(ImagingConstants.PARAM_KEY_COMPRESSION,
new Integer(TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED));


// tiffByteOrder set as appropriate for system
// fieldList is an array list of TiffOutputFields that 
//   was set by a utility class.
TiffImageWriterLossy lWriter =
new TiffImageWriterLossy(tiffByteOrder);

TiffOutputDirectory tiffDirectory = new TiffOutputDirectory(
TiffDirectoryConstants.DIRECTORY_TYPE_DIR_0, tiffByteOrder);
for (TiffOutputField field : fieldList) {
tiffDirectory.add(field);
}

TiffOutputSet tiffOutputSet = new TiffOutputSet();
tiffOutputSet.addDirectory(tiffDirectory);
params.put(ImagingConstants.PARAM_KEY_EXIF, tiffOutputSet);

FileOutputStream fos = new FileOutputStream(outputFile);
BufferedOutputStream bos = new BufferedOutputStream(fos);
lWriter.writeImage(outputImage, bos, params);
bos.flush();
bos.close();
fos.close();




One question.  When I 
-Original Message-
From: Damjan Jovanovic [mailto:damjan@gmail.com] 
Sent: Thursday, April 26, 2012 12:02 AM
To: Commons Developers List
Subject: Re: [sanselan] EXIF_TAG_MODIFY_DATE removed from new imaging package?

On Wed, Apr 25, 2012 at 10:30 PM, Gary Lucas gwlu...@sonalysts.com wrote:
 I'm taking a stab at transitioning from Sanselan to the new Apache Imaging.   
 One thing I've noticed is that one of the EXIF tags my existing software uses 
 seems to have been removed from imaging:

  public static final TagInfo EXIF_TAG_MODIFY_DATE = new TagInfo(
            Modify Date, 0x0132, FIELD_TYPE_ASCII, 1, 
 EXIF_DIRECTORY_IFD0);


 I'm not familiar with the details behind this tag.   Was it removed because 
 it is obsolete or non-standard?    An oversight?

 Thanks.

 Gary

One of the recent changes was deduplication of TIFF tags, and grouping of tags 
by specification.

Tag 0x0132 is defined in the TIFF6 specification, so it is now under 
TiffTagConstants, and known as TIFF_TAG_DATE_TIME.

Also I am considering replacing the EXIF_ prefix with TIFF_ for all tags.

Damjan

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



RE: [sanselan] EXIF_TAG_MODIFY_DATE removed from new imaging package?

2012-04-26 Thread Gary Lucas

Since we're on the subject, another question.  In encoding data, I was 
constructing field types and coding the information.  But it looks like you've 
got some static declarations for doing the same thing.  Could you verify that 
the following is your intended approach

public TiffOutputField encodeASCII(TagInfo tInfo, String string)
throws ImageWriteException,  ImageWriteException
{
//  previous approach:
//FieldType fType = new FieldTypeAscii(2, ASCII);
//byte bytes[] = fType.writeData(string, byteOrder);

byte bytes[] = FieldType.FIELD_TYPE_ASCII.writeData(string, byteOrder);

TiffOutputField tiffOutputField =
new TiffOutputField(
tInfo.tag,
tInfo,
FieldType.FIELD_TYPE_ASCII,
bytes.length,
bytes);
return tiffOutputField;
}


-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Re: [sanselan] EXIF_TAG_MODIFY_DATE removed from new imaging package?

2012-04-26 Thread Damjan Jovanovic
On Thu, Apr 26, 2012 at 2:16 PM, Gary Lucas gwlu...@sonalysts.com wrote:

 Since we're on the subject, another question.  In encoding data, I was 
 constructing field types and coding the information.  But it looks like 
 you've got some static declarations for doing the same thing.  Could you 
 verify that the following is your intended approach

    public TiffOutputField encodeASCII(TagInfo tInfo, String string)
            throws ImageWriteException,  ImageWriteException
    {
        //      previous approach:
        //        FieldType fType = new FieldTypeAscii(2, ASCII);
        //        byte bytes[] = fType.writeData(string, byteOrder);

        byte bytes[] = FieldType.FIELD_TYPE_ASCII.writeData(string, byteOrder);

        TiffOutputField tiffOutputField =
                new TiffOutputField(
                tInfo.tag,
                tInfo,
                FieldType.FIELD_TYPE_ASCII,
                bytes.length,
                bytes);
        return tiffOutputField;
    }

Do your emails keep getting cut short?

The easiest way, for a known tag type, is:

tiffOutputDirectory.add(TiffTagConstants.TIFF_TAG_DATE_TIME,
2012-04-25 01:23:45);

which supports IDE code completion, and automatically overloads to the
correct method based on the tag type.

For an unknown tag type, I think you have to use the old way where you
construct a TiffOutputField yourself.

Damjan

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



RE: [sanselan] EXIF_TAG_MODIFY_DATE removed from new imaging package?

2012-04-26 Thread Gary Lucas
Excellent again!   Much better.

I'm not sure how that last email got cut short, but you've answered my 
question.  So thanks.



g.



-Original Message-
From: Damjan Jovanovic [mailto:damjan@gmail.com] 
Sent: Thursday, April 26, 2012 8:26 AM
To: Commons Developers List
Subject: Re: [sanselan] EXIF_TAG_MODIFY_DATE removed from new imaging package?

On Thu, Apr 26, 2012 at 2:16 PM, Gary Lucas gwlu...@sonalysts.com wrote:

 Since we're on the subject, another question.  In encoding data, I was 
 constructing field types and coding the information.  But it looks 
 like you've got some static declarations for doing the same thing.  
 Could you verify that the following is your intended approach

    public TiffOutputField encodeASCII(TagInfo tInfo, String string)
            throws ImageWriteException,  ImageWriteException
    {
        //      previous approach:
        //        FieldType fType = new FieldTypeAscii(2, ASCII);
        //        byte bytes[] = fType.writeData(string, byteOrder);

        byte bytes[] = FieldType.FIELD_TYPE_ASCII.writeData(string, 
 byteOrder);

        TiffOutputField tiffOutputField =
                new TiffOutputField(
                tInfo.tag,
                tInfo,
                FieldType.FIELD_TYPE_ASCII,
                bytes.length,
                bytes);
        return tiffOutputField;
    }

Do your emails keep getting cut short?

The easiest way, for a known tag type, is:

tiffOutputDirectory.add(TiffTagConstants.TIFF_TAG_DATE_TIME,
2012-04-25 01:23:45);

which supports IDE code completion, and automatically overloads to the correct 
method based on the tag type.

For an unknown tag type, I think you have to use the old way where you 
construct a TiffOutputField yourself.

Damjan

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Re: [sanselan] EXIF_TAG_MODIFY_DATE removed from new imaging package?

2012-04-26 Thread Damjan Jovanovic
Not your last one, the one before. It ends with:
One question.  When I
and there's nothing after it.

On Thu, Apr 26, 2012 at 2:31 PM, Gary Lucas gwlu...@sonalysts.com wrote:
 Excellent again!   Much better.

 I'm not sure how that last email got cut short, but you've answered my 
 question.  So thanks.



 g.



 -Original Message-
 From: Damjan Jovanovic [mailto:damjan@gmail.com]
 Sent: Thursday, April 26, 2012 8:26 AM
 To: Commons Developers List
 Subject: Re: [sanselan] EXIF_TAG_MODIFY_DATE removed from new imaging package?

 On Thu, Apr 26, 2012 at 2:16 PM, Gary Lucas gwlu...@sonalysts.com wrote:

 Since we're on the subject, another question.  In encoding data, I was
 constructing field types and coding the information.  But it looks
 like you've got some static declarations for doing the same thing.
 Could you verify that the following is your intended approach

    public TiffOutputField encodeASCII(TagInfo tInfo, String string)
            throws ImageWriteException,  ImageWriteException
    {
        //      previous approach:
        //        FieldType fType = new FieldTypeAscii(2, ASCII);
        //        byte bytes[] = fType.writeData(string, byteOrder);

        byte bytes[] = FieldType.FIELD_TYPE_ASCII.writeData(string,
 byteOrder);

        TiffOutputField tiffOutputField =
                new TiffOutputField(
                tInfo.tag,
                tInfo,
                FieldType.FIELD_TYPE_ASCII,
                bytes.length,
                bytes);
        return tiffOutputField;
    }

 Do your emails keep getting cut short?

 The easiest way, for a known tag type, is:

 tiffOutputDirectory.add(TiffTagConstants.TIFF_TAG_DATE_TIME,
 2012-04-25 01:23:45);

 which supports IDE code completion, and automatically overloads to the 
 correct method based on the tag type.

 For an unknown tag type, I think you have to use the old way where you 
 construct a TiffOutputField yourself.

 Damjan

 -
 To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
 For additional commands, e-mail: dev-h...@commons.apache.org



 -
 To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
 For additional commands, e-mail: dev-h...@commons.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Re: [sanselan] EXIF_TAG_MODIFY_DATE removed from new imaging package?

2012-04-25 Thread Damjan Jovanovic
On Wed, Apr 25, 2012 at 10:30 PM, Gary Lucas gwlu...@sonalysts.com wrote:
 I'm taking a stab at transitioning from Sanselan to the new Apache Imaging.   
 One thing I've noticed is that one of the EXIF tags my existing software uses 
 seems to have been removed from imaging:

  public static final TagInfo EXIF_TAG_MODIFY_DATE = new TagInfo(
            Modify Date, 0x0132, FIELD_TYPE_ASCII, 1, EXIF_DIRECTORY_IFD0);


 I'm not familiar with the details behind this tag.   Was it removed because 
 it is obsolete or non-standard?    An oversight?

 Thanks.

 Gary

One of the recent changes was deduplication of TIFF tags, and grouping
of tags by specification.

Tag 0x0132 is defined in the TIFF6 specification, so it is now under
TiffTagConstants, and known as TIFF_TAG_DATE_TIME.

Also I am considering replacing the EXIF_ prefix with TIFF_ for all tags.

Damjan

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org