[ https://issues.apache.org/jira/browse/SANSELAN-57?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13166131#comment-13166131 ]
Damjan Jovanovic commented on SANSELAN-57: ------------------------------------------ This only lets you change fields in one directory, and only works for TIFF. I agree that a way to specify metadata at the time an image is written is necessary, but that should be done for all image formats in a uniform way, and should allow you to write fields into any directory. I am going to defer this problem until after the next Sanselan release. > Add method to specify metadata (TiffOutputFields) when a new TIFF file is > created > --------------------------------------------------------------------------------- > > Key: SANSELAN-57 > URL: https://issues.apache.org/jira/browse/SANSELAN-57 > Project: Commons Sanselan > Issue Type: Improvement > Environment: All supported operating systems > Reporter: Gary Lucas > Attachments: Sanselan-57-TiffMetadataWriter.patch > > Original Estimate: 1h > Remaining Estimate: 1h > > I propose to add a new method to the TiffImageWriterBase class that will > simplify the process of adding metadata tags (any kind, not just the > geographic ones) to a TIFF file when it is created. I have a version of this > class ready for uploading, and will do so in a day or two if nobody has any > suggestions for alternatives. > The rationale for this new feature grows from a requirement to produce > GeoTIFF files. GeoTIFF's are a widely supported industry standard that takes > advantage of the fact that TIFF files permit the use of supplemental metadata > tags (TIFF's equivalent to EXIF tags). The GeoTIFF tags feature metadata > that allows the TIFF file to be tied to images of maps, convert pixels to > latitude/longitude coordinates, etc. > Although Sanselan does provide an API that allows an application to add such > tags to an existing image (TiffImageWriterLossy), this approach requires > writing the TIFF file twice. Since some GeoTIFF's can be quite large (50 > megs is common), this is a suboptimal approach. An API that permits the file > to be written just once would be preferred. > The new method will a variation of writeImage that includes an array list of > TiffOutputFields: > writeImage(BufferedImage src, OutputStream os, Map params, ArrayList > applicationSuppliedFieldList) > When the initial TIFF file header is created, Sanselan currently adds a > "directory" to the beginning of the file ("directory" is the term used in the > TIFF format specification to mean, simply, a collection of data). This > directory provides image metadata such as width, height, etc. The new method > will add application-supplied output fields to the initial directory. This > approach will have the advantage that an application will be able to obtain > metadata for a GeoTIFF file without actually reading the full body of the > image. It will also permit the creating of GeoTIFFs consistent with those > being produced by the U.S. Geological Survey and other agencies that provide > a complete set of geographic information in the first directory in the file. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira