MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenImageIO / read_image

Method read_image

src/python/py_imageinput.cpp:180–198  ·  view source on GitHub ↗

The read_image method is a bit different from the c++ interface. "function" is a function which takes a float, and the PyProgressCallback function is called automatically.

Source from the content-addressed store, hash-verified

178// "function" is a function which takes a float, and the
179// PyProgressCallback function is called automatically.
180object
181ImageInputWrap::read_image (TypeDesc format)
182{
183 // Allocate our own temp buffer and try to read the image into it.
184 // If the read fails, return None.
185 const ImageSpec &spec = m_input->spec();
186 size_t size = (size_t) spec.image_pixels() * spec.nchannels * format.size();
187 char *data = new char[size];
188 if (!m_input->read_image(format, data)) {
189 delete [] data; // never mind
190 return object(handle<>(Py_None));
191 }
192
193 object array = C_array_to_Python_array (data, format, size);
194
195 // clean up and return the array handle
196 delete [] data;
197 return array;
198}
199
200
201object

Callers 14

convert_filesFunction · 0.80
cryptFunction · 0.80
decryptFunction · 0.80
BOOST_FOREACHFunction · 0.80
copy_imageMethod · 0.80
convert_fileFunction · 0.80
read_untiledMethod · 0.80
print_sha1Function · 0.80
print_sha1Function · 0.80
dump_dataFunction · 0.80

Calls 4

C_array_to_Python_arrayFunction · 0.85
image_pixelsMethod · 0.80
specMethod · 0.45
sizeMethod · 0.45

Tested by 3

BOOST_FOREACHFunction · 0.64
test_readimageFunction · 0.64
copy_subimageFunction · 0.64