OIIO doesn't throw exceptions, so there should be no need to enclose OIIO calls
in a try/catch block.
My understanding is also that get_imagespec should simply return false if it
can't open the file.
Try putting the following code right after the loadable = ... line:
std::cout << "loadable = " << loadable << "\n";
if (! loadable) {
std::string err =
Im_ImageCache::GetInstance()->GetCache()->geterror();
std::cout << "error was: '" << err << "'\n";
}
std::cout.flush();
What happens in that case? Does it ever print the "loadable=" line? Or does
it crash inside the get_imagespec() call itself?
Does it fail this way with any GIF file? Or only with a particular one? (If
so, can you send it to me?)
It's very strange that it would crash inside libOpenJPEG. Are you using any
JPEG-2000 files?
-- lg
On Mar 19, 2012, at 2:19 PM, [email protected] wrote:
> Hi Larry,
>
> sorry - English isn't my native language. What I want to describe:
>
> I'm reading 3d models inside my application. Some old 3DS files have
> references to GIF files as texture references. If I understand the
> documentation for ImageCache these files should be ignored by ImageCache.
> What I do:
>
> bool loadable = false;
> try
> {
> loadable =
> Im_ImageCache::GetInstance()->GetCache()->get_imagespec(tmpName, tmpSpec);
> }
> catch(...)
> {
>
>
> GetCache() is my reference to ImageCache. LibOpenJPEG is linked only inside
> OIIO.
>
>
> FROM my understanding of OIIO documentation get_imagespec should return false
> if OIIO could not read the image format (for example a GIF file). Is this
> true?
>
> But I don't get false as a return value, I always get the exeption from
> j2k_decode.
>
> Best regards,
>
> Patrik
>
> Am 19.03.2012 22:00, schrieb Larry Gritz:
>> Could you clarify exactly what you mean by: "Now I've got a link to a gif
>> image for loading. OIIO should ignore it..."
>>
>> Do you mean that your application is also, separately, using LibOpenJPG on
>> its own and is holding an open handle of some sort? Of the same file?
>>
>> -- lg
>>
>>
>> On Mar 19, 2012, at 1:49 PM, [email protected] wrote:
>>
>>> Hi all,
>>>
>>> I've started using OpenImageIO as a replacement for FreeImage. Now I've got
>>> a problem with LibOpenJPG, and I'm not sure if its an configuration problem
>>> or an OIIO problem:
>>>
>>> OIIO is compiled as a DLL with static linking for most of the plugins.
>>>
>>> Inside my application I use the ImageCache. Now I've got a link to a gif
>>> image for loading. OIIO should ignore it, but I always got an exception
>>> inside Jpeg2000Input::open (...) in jpeg2000input.cpp:
>>>
>>>
>>> opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio,
>>> opj_codestream_info_t *cstr_info) {
>>> opj_image_t *image = NULL;
>>>
>>>
>>>
>>> ....
>>>
>>> if (id>> 8 != 0xff) {
>>> opj_image_destroy(image);
>>> opj_event_msg(cinfo, EVT_ERROR, "%.8x: expected a
>>> marker instead of %x\n", cio_tell(cio) - 2, id);
>>> return 0;
>>>
>>>
>>>> OpenImageIO.dll!j2k_decode(opj_j2k * j2k, opj_cio * cio,
>>>> opj_codestream_info * cstr_info) Zeile 1798 C
>>>
>>>
>>> Is this a known problem or a problem with my CMake settings?
>>>
>>> OIIO is build for VC2010 64 bit debug version.
>>>
>>> Thanks for any info,
>>>
--
Larry Gritz
[email protected]
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org