OpenImageOutput (object)¶
The OpenImageOutput is used to write images to disk. An OpenImageSpec is used when constructing an OpenImageOutput.
注釈
Please refer to the official OpenImageIO documentation for more details (https://sites.google.com/site/openimageio/documentation).
/*
** Example: OpenImageOutput
*/
require OpenImageIO;
require FileIO;
operator entry() {
FilePath path = FilePath('${TEMP}/test.png').expandEnvVars();
OpenImageSpec spec(512, 512, 3, OpenImageTypeDescTypeColor());
OpenImageTypeDesc desc = OpenImageTypeDesc(OpenImage_BASETYPE_UINT8, OpenImage_AGGREGATE_SCALAR, OpenImage_VECSEMANTICS_NOXFORM);
Byte bytes[];
bytes.resize(spec.get_full_width() * spec.get_full_height() * spec.get_nchannels());
Data data = bytes.data();
// fill on the first component, resulting in red pixels
for(Size i=0;i<bytes.size();i+=3)
bytes[i] = 255;
// writes a purely red image, 512x512 with 3 channels
OpenImageOutput img();
img.create(path.string());
img.open(path.string(), spec);
img.write_image(desc, data, 0, 0, 0);
img.close();
report(path.exists());
report('Written image '+path.string());
}
/*
** Output:
true
Written image R:\Temp/test.png
*/
Methods¶
OpenImageOutput ( in OpenImageOutput other ) | |
OpenImageOutput () | |
OpenImageOutput | clone ? () |
Boolean | close ! () |
Boolean | copy_image ? ( in OpenImageInput input ) |
create ! ( in String fileName ) | |
create ! ( in String fileName, in String pluginSearchPath ) | |
String | geterror ? () |
Boolean | open ! ( in String fileName, in OpenImageSpec spec ) |
reset ! () | |
OpenImageSpec | spec ? () |
Boolean | supports ? ( in String feature ) |
Boolean | valid ? () |
Boolean | write_deep_image ? ( in OpenImageDeepData deepdata ) |
Boolean | write_deep_scanlines ? ( in SInt32 ybegin, in SInt32 yend, in SInt32 z, in OpenImageDeepData deepdata ) |
Boolean | write_deep_tiles ? ( in SInt32 xbegin, in SInt32 xend, in SInt32 ybegin, in SInt32 yend, in SInt32 zbegin, in SInt32 zend, in OpenImageDeepData deepdata ) |
Boolean | write_image ? ( in OpenImageTypeDesc format, in Data data, in SInt64 xstride, in SInt64 ystride, in SInt64 zstride ) |
Boolean | write_rectangle ? ( in SInt32 xbegin, in SInt32 xend, in SInt32 ybegin, in SInt32 yend, in SInt32 zbegin, in SInt32 zend, in OpenImageTypeDesc format, in Data data, in SInt64 xstride, in SInt64 ystride, in SInt64 zstride ) |
Boolean | write_scanline ? ( in SInt32 y, in SInt32 z, in OpenImageTypeDesc format, in Data data, in SInt64 xstride ) |
Boolean | write_scanlines ? ( in SInt32 ybegin, in SInt32 yend, in SInt32 z, in OpenImageTypeDesc format, in Data data, in SInt64 xstride, in SInt64 ystride ) |
Boolean | write_tile ? ( in SInt32 x, in SInt32 y, in SInt32 z, in OpenImageTypeDesc format, in Data data, in SInt64 xstride, in SInt64 ystride, in SInt64 zstride ) |
Boolean | write_tiles ? ( in SInt32 xbegin, in SInt32 xend, in SInt32 ybegin, in SInt32 yend, in SInt32 zbegin, in SInt32 zend, in OpenImageTypeDesc format, in Data data, in SInt64 xstride, in SInt64 ystride, in SInt64 zstride ) |
~OpenImageOutput () |
Methods in detail¶
OpenImageOutput ( in OpenImageOutput other )
copy constructor
OpenImageOutput OpenImageOutput.clone? ()
clone method
Boolean OpenImageOutput.close! ()
Boolean OpenImageOutput.copy_image? ( in OpenImageInput input )
OpenImageOutput.create! ( in String fileName )
OpenImageOutput.create! ( in String fileName, in String pluginSearchPath )
String OpenImageOutput.geterror? ()
Boolean OpenImageOutput.open! ( in String fileName, in OpenImageSpec spec )
OpenImageOutput.reset! ()
OpenImageSpec OpenImageOutput.spec? ()
Boolean OpenImageOutput.supports? ( in String feature )
Boolean OpenImageOutput.valid? ()
Boolean OpenImageOutput.write_deep_image? ( in OpenImageDeepData deepdata )
Boolean OpenImageOutput.write_deep_scanlines? ( in SInt32 ybegin, in SInt32 yend, in SInt32 z, in OpenImageDeepData deepdata )
Boolean OpenImageOutput.write_deep_tiles? ( in SInt32 xbegin, in SInt32 xend, in SInt32 ybegin, in SInt32 yend, in SInt32 zbegin, in SInt32 zend, in OpenImageDeepData deepdata )
Boolean OpenImageOutput.write_image? ( in OpenImageTypeDesc format, in Data data, in SInt64 xstride, in SInt64 ystride, in SInt64 zstride )
Boolean OpenImageOutput.write_rectangle? ( in SInt32 xbegin, in SInt32 xend, in SInt32 ybegin, in SInt32 yend, in SInt32 zbegin, in SInt32 zend, in OpenImageTypeDesc format, in Data data, in SInt64 xstride, in SInt64 ystride, in SInt64 zstride )
Boolean OpenImageOutput.write_scanline? ( in SInt32 y, in SInt32 z, in OpenImageTypeDesc format, in Data data, in SInt64 xstride )
Boolean OpenImageOutput.write_scanlines? ( in SInt32 ybegin, in SInt32 yend, in SInt32 z, in OpenImageTypeDesc format, in Data data, in SInt64 xstride, in SInt64 ystride )
Boolean OpenImageOutput.write_tile? ( in SInt32 x, in SInt32 y, in SInt32 z, in OpenImageTypeDesc format, in Data data, in SInt64 xstride, in SInt64 ystride, in SInt64 zstride )
Boolean OpenImageOutput.write_tiles? ( in SInt32 xbegin, in SInt32 xend, in SInt32 ybegin, in SInt32 yend, in SInt32 zbegin, in SInt32 zend, in OpenImageTypeDesc format, in Data data, in SInt64 xstride, in SInt64 ystride, in SInt64 zstride )
~ OpenImageOutput ()