3

I would like to add image data (a numpy matrix) to an already existing Multipage TIFF file using the tifffile module from Christoph Gohlke: http://www.lfd.uci.edu/~gohlke/code/tifffile.py.html

And I would like to do it without having to load the whole file because it can be a heavy one (long fluorescence microscopy experiments...). On this page: https://github.com/scienceopen/pyimagevideo/blob/master/Demo_image_write_multipage.py line 68 they say it is possible, but they just say "read the code", and I couldn't figure out how to append images doing so. I tried

tifffile.save(ImagePath, ImageData) and

with tifffile.TiffWriter(ImagePath) as tif2write:
    tif2write.save(ImageData)

but I doesn't append data, it overwrites the file.

Alexis Cllmb
  • 107
  • 7
  • This is just me, but I've been looking over their code for about an hour, and I still don't see how, without modifying it, we can append data to the image. I see how to open the image without reading any data, but writing to that same image is a bit of a mystery...I don't think their `ImageWriter` class has that capability, i.e. to write to a `TiffFile` instance. Even so, it would be nice to have a clear method. – bjd2385 Dec 16 '16 at 00:32

1 Answers1

2

I finally wrote to Christoph Gohlke and indeed he said that his module couldn't append a new image to a TIFF file. So he modified his module and now we can append as many images desired to an already existing file! Check on his website http://www.lfd.uci.edu/~gohlke/code/tifffile.py.html, the version that couldn't do it was the Revision 2016.10.28, so if on his website you find a newer "Revision" it should work, in the meantime... be patient ;)

Alexis Cllmb
  • 107
  • 7