Thanks chaps, that helped. Regards,
On 13 September 2017 at 21:46, <[email protected]> wrote: > Send Oiio-dev mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org > or, via email, send a message with subject or body 'help' to > [email protected] > > You can reach the person managing the list at > [email protected] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Oiio-dev digest..." > > > Today's Topics: > > 1. Re: Dpx clamping (Larry Gritz) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Wed, 13 Sep 2017 12:25:10 -0700 > From: Larry Gritz <[email protected]> > To: OpenImageIO developers <[email protected]> > Subject: Re: [Oiio-dev] Dpx clamping > Message-ID: <[email protected]> > Content-Type: text/plain; charset="us-ascii" > > > # output buffer > > if destination.split('.')[-1].lower() == 'dpx': > > format = oiio.UINT16 > > else: > > format = oiio.FLOAT > > > > output_buffer = oiio.ImageBuf(oiio.ImageSpec (width, height, > framebuffer_channels, format)) > > Don't do that! That will limit the buffer itself to 16 bit integer > values. Allocate the buffer as float. > > You generally will want all internal computations to be in float, and use > uint16 just as a detail of the output file format. What you want is this, > at the end: > > > if destination.split('.')[-1].lower() == 'dpx': > > output_buffer.write_format (oiio.UINT16) > > output_buffer.specmod().attribute('oiio:BitsPerPixel', 10) > > # otherwise leave as float > > > > # write > > output_buffer.write(destination) > > So this is just giving instructions for how to write the file to disk, not > changing the precision of any internal buffers. > > > > On Sep 13, 2017, at 11:02 AM, Elliott Smith <[email protected]> wrote: > > > > Good afternoon, > > > > I'm trying to mimic the behaviour of oiiotool with the python bindings. > > > > The command I want to mimic is: > > > > oiiotool inputfile.exr --resize:filter=cubic 1920x1080 --colorconvert > linear AlexaV3LogC -d uint16 -o outfile.dpx > > > > When I perform this via oiiotool, I get a dpx that matches the one I get > from nuke. When I do this via the bindings, the highlights seem to be > clamped. > > > > The code I'm using is as follows, as well as a screengrab of the > difference i'm seeing when I stop down the exposure. > > > > Any suggestions would be most welcome. > > > > Elliott > > > > def convert(source, destination, input_colorspace, output_colorspace, > width, height, filtername, working_colorspace='linear'): > > > > framebuffer = oiio.ImageBuf(source) > > framebuffer_width = framebuffer.spec().width > > framebuffer_height = framebuffer.spec().height > > framebuffer_channels = framebuffer.nchannels > > > > if width == 0: > > width = framebuffer_width > > if height == 0: > > height = framebuffer_height > > > > # linearise > > oiio.ImageBufAlgo.colorconvert(framebuffer, framebuffer, > input_colorspace, working_colorspace) > > > > # output buffer > > if destination.split('.')[-1].lower() == 'dpx': > > format = oiio.UINT16 > > else: > > format = oiio.FLOAT > > > > output_buffer = oiio.ImageBuf(oiio.ImageSpec (width, height, > framebuffer_channels, format)) > > > > # resize > > if width == framebuffer_width and height == framebuffer_height: > > output_buffer.copy(framebuffer, format) > > else: > > oiio.ImageBufAlgo.resize(output_buffer, framebuffer, > filtername) > > > > # color convert > > oiio.ImageBufAlgo.colorconvert(output_buffer, output_buffer, > working_colorspace, output_colorspace) > > > > # set dpx bitdepth > > if destination.split('.')[-1].lower() == 'dpx': > > output_buffer.specmod().attribute('oiio:BitsPerPixel', 10) > > > > # write > > output_buffer.write(destination) > > > > > > <dpx_diff.png> > > > > > > > > > > <oiio_convert.py>_______________________________________________ > > Oiio-dev mailing list > > [email protected] > > http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org > > -- > Larry Gritz > [email protected] > > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: <http://lists.openimageio.org/pipermail/oiio-dev- > openimageio.org/attachments/20170913/1431c4e0/attachment.html> > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > Oiio-dev mailing list > [email protected] > http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org > > > ------------------------------ > > End of Oiio-dev Digest, Vol 108, Issue 5 > **************************************** >
_______________________________________________ Oiio-dev mailing list [email protected] http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
