geotiff.js icon indicating copy to clipboard operation
geotiff.js copied to clipboard

Support the Baseline TIFF 'metadata' tags (all ASCII) when writing

Open timhj opened this issue 1 year ago • 2 comments
trafficstars

There are 5 tags available in the Baseline TIFF spec which are useful to put additional ASCII information into created files using writeArrayBuffer but the metadata doesn't exist or isn't able to be inserted because the tagTypes fail a lookup test and throw error eg Error: unknown type of tag: (270,271,272,315 or 33432) when they're added as metadata. There must be a lookup happening as when the tags are specified with their name, the error returned is with the correct associated Tag Code for that type name.

ASCII type tags not currently supported for writing:

Artist: 'Person who created the image.', // 315 (hex 0x013B) 
ImageDescription: 'A string that describes the subject of the image.',  // 270 (hex 0x010E)
Copyright: 'Copyright from original source image' // 33432 (hex 0x8298)
Make: 'The scanner manufacturer.', // Code	271 (hex 0x010F)
Model: 'The model name or number of the scanner, video digitizer, or other type of equipment used to generate the image.', // 272 (hex 0x0110)

The above are all ASCII type tags and listed with the Tag code as a comment at the end. Adding support to the writer for this metadata would be a useful addition to the library.

Full list of baseline tags is here: https://www.awaresystems.be/imaging/tiff/tifftags/baseline.html

timhj avatar Jun 19 '24 03:06 timhj

Great idea! Would you be interested in submitting a PR? Indeed you are correct that a lookup is happening in geotiffwriter that is referencing globals.js. I think adding this info to globals.js would fix the problem, but adding a test is always a good idea, too!

DanielJDufour avatar Jun 19 '24 03:06 DanielJDufour

@DanielJDufour - Done, PR requested. Unit test not written but have built and tested the changes and all worked as expected (Error: unknown type of tag: errors are gone, Metadata is written to appropriate fields and visible in Image viewers.

Thanks for all your work on a great library.

timhj avatar Jun 20 '24 03:06 timhj