Closed dbuscombe-usgs closed 3 years ago
Writing image data is outside the scope of tifftools
.
I would use a library like pyvips to do it (see the pyvips.Image.new_from_memory
method for converting numpy to vips). If you need to adjust metadata more than vips allowed, I'd take the output tiff from vips and manipulate it using tifftools or some other tool.
I'm closing this issue as writing image data is beyond what tifftools is ever intended to do.
Ok, fair enough - thanks for responding. Good tip on the pyvips
package
Please could you provide more examples for how to use this tool to write tiffs from scratch? Thanks SO much for providing this tool. I really hope I can make it work for me!
Problem:
Alternatives tried:
So I'm really hoping I can use tifftools, but I cant figure out (from the one provided example) how to write a tiff entirely from scratch using arrays
Question: The provided example is useful, but only deals with the case where all the
info
is obtained from an existing fileinfo = tifftools.read_tiff(file)
But how would you create that
info
object from an numpy array, metadata, and exif separately? where metadata and exif are two separate dicts or JSON objects (or whatever)?I also found this that helpfully explains how to add info to an existing tiff
In summary, I'm looking for advice for how to construct a viable
info
object that can be passed to.write_tif
like thistifftools.write_tif(info, ...)
where
info
is constructed from 1) a numpy array containing the image, 2) an array or dictionary of exif data, and 3) an array or dictionary of other metadata (tags)