If you run

        oiiotool --help

At the bottom it will show you all the image formats whose support is compiled 
in (or whose DLL/DSO plugins can be found). It will only print the format 
names, not the extensions. Console output of oiiotool is not specifically 
designed to be machine-readable, so there are no parsing guidelines and the 
specific layout of the list may change from release to release.

But it may be better to do this programmatically rather than relying on 
oiiotool. For example, consider the following Python:

    import OpenImageIO as oiio
    formatlist = oiio.get_string_attribute ("extension_list")
    print (formatlist)

Or the equivalent C++:

    std::string formatlislt = OIIO::get_string_attribute ("extension_list");

This will give you a string like

bmp:bmp;cineon:cin;dds:dds;dpx:dpx;ffmpeg:avi,mov,qt,mp4,m4a,3gp,3g2,mj2,m4v,mpg;field3d:f3d;fits:fits;gif:gif;hdr:hdr,rgbe;ico:ico;iff:iff,z;jpeg:jpg,jpe,jpeg,jif,jfif,jfi;jpeg2000:jp2,j2k,j2c;openexr:exr,sxr,mxr;png:png;pnm:ppm,pgm,pbm,pnm,pfm;psd:psd,pdd,psb;ptex:ptex,ptx;raw:bay,bmq,cr2,crw,cs1,dc2,dcr,dng,erf,fff,k25,kdc,mdc,mos,mrw,nef,orf,pef,pxn,raf,raw,rdc,sr2,srf,x3f,arw,3fr,cine,ia,kc2,mef,nrw,qtk,rw2,sti,rwl,srw,drf,dsc,cap,iiq,rwz;rla:rla;sgi:sgi,rgb,rgba,bw,int,inta;socket:socket;softimage:pic;tiff:tiff,tif,tx,env,sm,vsm;targa:tga,tpic;webp:webp;zfile:zfile;osl:osl,oso,oslgroup,oslbody

The basic format is semicolon-separated lists of formats, where each format 
consists of the format name, a colon, and then a comma-separated list of 
extensions that it assumes are associated with the formats.

Take the format names with a grain of salt. They are ambiguous and not 
necessarily unique, and are used within OIIO only to a very limited extent. 
When opening a file for reading, the extension provides a first guess about 
which format a file may be, but if the guess fails it will simply try all 
format readers until one opens the file successfully. You can rename a TIFF 
file "blah.foo" or even "blah.jpg", and OIIO will read it just fine, though 
behind the scenes it may end up trying to open it with a variety of readers 
before it succeeds. For writing, there are parts of OIIO that will choose the 
file type based on the extension, merely by looking for the first format 
containing that extension in its list.


> On Apr 27, 2016, at 2:02 AM, Élie Michel <[email protected]> wrote:
> 
> Hello,
> 
> Is there a way to get from oiiotool a machine readable list of known file 
> extensions?
> 
> More generally, are they guidelines about parsing the output of this tool?
> 
> Best,
> Élie
> 
> _______________________________________________
> Oiio-dev mailing list
> [email protected]
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

--
Larry Gritz
[email protected]


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

Reply via email to