Thank you for the help! That worked!
I have one follow up question, in the doc, you have the following code to
test if a file supports ioproxy.

auto in = ImageInput::create(filename);
if (! in  ||  ! in->supports ("ioproxy")) {
    return;
}

Does the filename given in the call to ImageInput::create(filename) have to
point to a file on disc?
Part of what i'm doing is abstracting away the usage of filepaths
completely.  I can still find out the filename and extension so what i was
hoping to do is
something like
std:string fileName = getFileName()
ImageInput::create(fileName);
...

fileName wouldn't necessarily be the filepath but would contain the name of
the image file I want to load using ioproxy.

On Mon, Dec 16, 2019 at 1:16 PM Larry Gritz <l...@larrygritz.com> wrote:

> It's probably an error in the docs.
>
> Just use the static open as advertised:
>
>     auto in = ImageInput::open ("in.exr", &config);
>
> Sorry about the error in the docs.
>
>
> On Dec 16, 2019, at 12:41 PM, hyper654 <hyper...@gmail.com> wrote:
>
> The link above points me to the following code snippet for reading with
> ioproxy.
>
> const void *buf = ...;   // pointer to memory blocksize_t size = ...;       
> // length of memory block
> ImageSpec config; // ImageSpec describing input configuration 
> optionsFilesystem::IOMemReader memreader (buf, size);  // I/O proxy 
> objectvoid *ptr = &memreader;config.attribute ("oiio:ioproxy", TypeDesc::PTR, 
> &ptr);
> ImageSpec spec;auto in = ImageInput::open ("in.exr", spec, 
> &config);in->read_image (...);in->close();
>
> the call i'm having trouble compiling is
> auto in = ImageInput::open ("in.exr", spec, &config);
>
> I looked at RB-2.1 and the master branch and in both cases this signature 
> requires an object?
> I looking at imageio.h the only static method for open has the following 
> signature
>  static unique_ptr open (const std::string& filename,
>                          const ImageSpec *config = nullptr);
>
> Maybe i'm not looking at the right branch?
>
>
>
>
> On Mon, Dec 16, 2019 at 10:56 AM Larry Gritz <l...@larrygritz.com> wrote:
>
>> Yes, I just fixed that in the source a couple days ago!
>>
>> I think the current docs for master should be updated already:
>> https://openimageio.readthedocs.io/en/master/imageinput.html
>> And the 2.1 ones will be fixed upon the next release.
>>
>>
>>
>> On Dec 16, 2019, at 10:24 AM, hyper654 <hyper...@gmail.com> wrote:
>>
>> I'm interested in using ioproxy to read exr file from a stream. I've been
>> looking through the documentation on how to read a file from memory buffer
>> but have noticed that some of the sample code is out of date?
>> The example on page 72 of the pdf has
>> ImageInput *in = ImageInput::open ("in.exr", spec, &config);
>>
>> This overload is no longer static
>>
>> https://github.com/OpenImageIO/oiio/blob/RB-2.1/src/include/OpenImageIO/imageio.h
>> - Line 977
>> I attempted to work around this by creating an object first via
>> ImageInput::create, however i'm crashing. I'm wondering if there is an
>> updated doc I can look at on how to properly use ioproxy?
>>
>> Looking at github,
>> --
>> -Jose Medina
>> _______________________________________________
>> Oiio-dev mailing list
>> Oiio-dev@lists.openimageio.org
>> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
>>
>>
>> --
>> Larry Gritz
>> l...@larrygritz.com
>>
>>
>>
>>
>> _______________________________________________
>> Oiio-dev mailing list
>> Oiio-dev@lists.openimageio.org
>> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
>>
>
>
> --
> -Jose Medina
> _______________________________________________
> Oiio-dev mailing list
> Oiio-dev@lists.openimageio.org
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
>
>
> --
> Larry Gritz
> l...@larrygritz.com
>
>
>
>
> _______________________________________________
> Oiio-dev mailing list
> Oiio-dev@lists.openimageio.org
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
>


-- 
-Jose Medina
_______________________________________________
Oiio-dev mailing list
Oiio-dev@lists.openimageio.org
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to