On Mar 23, 2016, at 1:04 PM, Torbjörn Rathsman <[email protected]> wrote:
> 
> Is it possible to use callbacks for reading/writing images? It appears that 
> it is not, since the relevant CTOR:s only accepts a filename, not a struct 
> with function pointers.
> 
> What I would like to do is to read images directly from a zip archive (data 
> are read by using zip_fread).
> 

Unfortunately, this is not currently a supported feature.

For some image formats, OIIO does its own I/O and decoding, but for many 
(really, all of the complicated ones), we rely on dependencies to do the heavy 
lifting of individual formats (examples include libtiff or OpenEXR's libIlmImf).

Many individual format libraries allow you to pass custom open/read/write 
methods that you could overload so that they don't really do direct file I/O, 
but instead read from memory buffers or zip files or whatever. I think this is 
what you're after -- you would be doing zip file reads under the covers.

The problem is that the various format libraries we use each support DIFFERENT 
and incompatible sets of functions that need to be overloading. Just to pick a 
simple example, one may be based on open/read/write, another may be based on 
fopen/fread/etc., and so on.

Since the whole idea of OIIO is to mask the specifics of the formats, it's not 
clear how we'd make this work for all of them with a single API. Maybe we could 
just expect people to support overloading ALL the possible methods needed by 
any of our formats. But so far nobody has done the full inventory to see what 
it would involve.

I can definitely see the merits of this, and if somebody wanted to propose and 
implement this feature, I would be happy. But requests for this have been few 
and far between, so thus far nobody has taken the time to implement it.

        -- lg

--
Larry Gritz
[email protected]


_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to