Hi again! Glad you're getting closer. I checked the psd I based the snippet on and it was indeed 8bit only. Have you tried converting the data format with ImageBuf.read() in stead of ImageBuf.reset()?
>From the docs: "bool ImageBuf.read (subimage=0, miplevel=0, force=False, convert=oiio.UNKNOWN)" On Wed, Oct 31, 2018 at 1:21 PM Ray <[email protected]> wrote: > I've discovered that what I'm looking for works perfectly fine with 8-bit > psd files, but not with 16 or 32-bit files. > > Looking at the spec for the files as they're being read in to the buffer > it looks like it's reading in the formats correctly: > > - 8-bit: uint8 > - 16-bit: uint16 > - 32-bit: float > > > However, given the broad range of TypeDesc Basetype values I may be > incorrect, since I could also consider Half a valid value for 16-bit. > > Has anyone come across this before? Is there something I need to do when > reading the buffer to change the behaviour for reading the layers for non > 8-bit images?? > > On Tue, 30 Oct 2018 at 12:19, Ray <[email protected]> wrote: > >> Hi Daniel, >> >> Thanks for the quick reply! >> >> Unfortunately that code snippet doesn't work for me on version 1.8.11. >> I'll check to see if it's a problem with the version or with the Photoshop >> file I'm using. >> >> On Tue, 30 Oct 2018 at 11:56, Daniel Flehner Heen < >> [email protected]> wrote: >> >>> Hey Ray! >>> >>> Strange that nsubimages are always 1. I've successfully done the >>> following in python (oiio1.8.5): >>> >>> import OpenImageIO as oiio >>> >>> sourcefile = '/path/to/sourcefile.psd' >>> buf = oiio.ImageBuf(sourcefile) >>> >>> for layer in range(buf.nsubimages): >>> buf.reset(sourcefile, subimage=layer) >>> buf.write('/tmp/mylayer_{l}.exr'.format(l=layer)) >>> >>> >>> >>> On Tue, Oct 30, 2018 at 12:01 PM Ray <[email protected]> wrote: >>> >>>> Hi All, >>>> >>>> I'm looking to import a PSD file, split it into it's respective layers, >>>> and export each layer as an .exr file. I've been looking through the >>>> documentation and it seems like it could be done with the PSDInput in C++ >>>> (I have yet to try) but when I try to achieve this in python there doesn't >>>> seem to be any way to access the layers that I can see. >>>> >>>> When I import my psd file it loads in just fine, and when I export the >>>> whole image as exr it works as expected. What's not working for me (or I'm >>>> doing it wrong) is accessing the layers themselves. When I try to view the >>>> number of subimages there is only ever one. >>>> >>>> Is there something I'm missing, or is this something that I'll need to >>>> do in C++? >>>> >>>> Many thanks, >>>> Ray. >>>> _______________________________________________ >>>> Oiio-dev mailing list >>>> [email protected] >>>> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org >>>> >>> >>> >>> -- >>> -Daniel >>> _______________________________________________ >>> Oiio-dev mailing list >>> [email protected] >>> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org >>> >> _______________________________________________ > Oiio-dev mailing list > [email protected] > http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org > -- -Daniel
_______________________________________________ Oiio-dev mailing list [email protected] http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
