Is there a way in LibTiff how I can read a file from Memory and save it to Memory?
I don't want to save the image to the disc first, before opening it with an other library...
Thanks so much!
Is there a way in LibTiff how I can read a file from Memory and save it to Memory?
I don't want to save the image to the disc first, before opening it with an other library...
Thanks so much!
I know this is an old question, but I am going to post an easier, more up-to-date answer for those like myself who need this information for more recent versions of libtiff. In the newest version of libtiff (4.0.2), and even the past few versions I believe (check for your specific version number), there is an include file called tiffio.hxx. It has two extern functions for reading/writing to streams in memory:
You can just include this file and read or write to memory.
Writing example:
Reading is very similar:
These are very simple examples, but you can see that by using TIFFStreamOpen you don't have to override those functions and pass them to TIFFClientOpen.
What I'm using...:
And then:
In order to use the in-memry buffer:
You should create your own read/write/etc. functions and pass them to
TIFFClientOpen
(notTIFFOpen
) function when creating yourTIFF
.Example:
And you should also implement following functions (
st
passed to these functions is thesomething_you_will_use_later
passed toTIFFClientOpen
: