I’ve tried using the C++ interface by setting the “planarconfig” attribute in the ImageSpec used ImageOutput but the resulting image is corrupted.
Here’s what I’m doing: 1. I’m opening a JPEG that is 4272 pixels wide as TypeDesc::UINT8. 2. I pass the buffer of pixel data to the third party code which returns the data as UINT8, but planar. However, each row of image data now has 8 bytes of padding so each row is 4280 bytes long. My planar to interleaved conversion code ignores these 8 bytes in each row. 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. On May 19, 2017 at 1:22 PM, Larry Gritz <[email protected]> wrote: You can convert between planar configurations (for formats that support the distinction) on the command line with oiiotool: oiiotool myinterleaved.tif --planarconfig separate -o myseparate.tif oiiotool mycontiguous.tif --planarconfig contig -o myinterleaved.tif If you're using the C++ interface, you don't have to actually "do" anything, no shuffling of memory on your own, it's all handled in the output just by setting that one attribute for the output configuration. I'm not sure what you mean by "padding". Can you explain what you're trying to achieve? Full PDF documentation (a 400 page book!) can be found in the OIIO distribution itself. Look for openimageio.pdf. On May 19, 2017, at 10:13 AM, Steve Huey <[email protected]> wrote: Hi, I’ve just started using OpenImageIO to load and save images which I’m apply some effects to with a a third party library. After processing, the third party library converts images to planar (separate) format, and adds some padding to each row. I’ve been converting them back to interleaved (contig) using some code I wrote before saving the images with OpenImageIO but noticed that some of the command line tools included with the OpenImageIO distribution support this conversion as well. If OpenImageIO can handle this conversion for me, I’d like to learn how. >From looking at the source for some of these tools they just appear to set call the attribute method of the ImageSpec class with something like: spec.attribute(“planarconfig”, “contig”). Because of the row padding (I think) this approach isn’t working for me, and the output image is corrupted. Given this, I have two questions: 1. Does OpenImageIO support conversion from planar to interleaved with padding? 2. If so, can you please point me in the direction of the recommended functions / docs? Thanks, Steve Huey -- // Steven Huey * Senior Software Engineer // [email protected] // www.artandlogic.com // Art & Logic -- Coding the "impossible."™ _______________________________________________ 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
_______________________________________________ Oiio-dev mailing list [email protected] http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
