Open alexlsa opened 3 months ago
When you do tifftools.read_tiff(<buffer or path>)
it returns a data structure that includes a list of the ifds (directories). split stores each directory as its own file; merge takes a list of ifds from a list of files are writes out the result.
You can reference individual ifds, and create a new list and then save it. For instance, this merges the first two ifds from a first source with the last two ifds from a second source. The sources and destinations can be paths or streams or io buffers. Depending on the actual contents of the sources, the program may use temp files as part of its processing.
info1 = tifftools.read_tiff(<source 1>)
info1['ifds'] # this is a list
info2 = tifftools.read_tiff(<source 2>)
mergedifds = info1['ifds'][:2] + info2['ifds'][-2:]
tifftools.write_tiff(merged_ifds, <destination>)
Thank you @manthey, it worked very well. Now I can remove any level (ifds) from source file
One small question : Is it possible to delete ifds
without reading whole source file ? I mean, I do not want to read and write source file, because file is very big I just want to remove specific ifds from generic tif
. All operations will be done on a single source file
tifftools won't do that -- it isn't within its design intent. But you can modify a tiff file to skip ifds. An ifd has a structure of
Thank you,
Can I do this with tifftools ? or maybe python tifffile ?
Hi,
Thanks for this project
Is it possible to run split and merge with python interface without using the filesystem ?