On May 19, 2017 at 1:58 PM, Larry Gritz <[email protected]> wrote:

All good up to this point.

So you are doing something like:

    my_conversion (modified);
    // Now modified points to interleaved scanlines of 4272 pixels each,
    // but each scanline is spaced 4280*nchannels bytes apart. Right?

Is that right?


No - after my conversion from planar to interleaved, the scanlines are 4272
* nchannels bytes apart. I copy the data from the buffer used by the third
party code into a new interleaved buffer.


3. I’m able to save the image using OpenImageIO without issue using my
conversion code. I’d like to know if there’s a way to call
attribute(“planarconfig”, “contig”), pass it planar data, and have it
ignore those 8 bytes of padding in each row of data.


No, there is no way to do that. OIIO's APIs assume/require contiguous
(interleaved) configuration on the app side of the interface. The attribute
you mention requests that your interleaved data be saved as contiguous in
the file itself. (The distinction is not a choice for JPEG files anyway.
TIFF is the only format that lets you choose, I think.)

So let's keep your conversion conversion code, it is required.

The way to output with padding is:

    ImageOutput *out = ImageOutput::create ("out.jpg");
    out->open ("out.jpg", inspec);   // just copy the spec from input
    out->write_image (TypeDesc::UINT8, &modified[0],
                                   nchannels,   // custom pixel-to-pixel
stride
                                   4280 * nchannels);  // custom
scanline-to-scanline stride
    out->close ();
    ImageOutput::destroy (out);


Does that help?


Yes - thank you. I’ll stick with my conversion code for now and have
started reading the PDF documentation you referenced, which looks excellent!
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to