I have looked through some of the documentation available Here for Vips but have not found an answer yet.
I want to put the image into a numpy 3D array similar to how PIL images automatically get processed this way:
In[1]: import numpy
In[2]: from PIL import Image
In[3]: image = Image.open('43.jpg')
In[4]: image
Out[4]: <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=3216x2136 at 0x7F0C8D8B9950>
In[5]: imgArray2 = numpy.asarray(image, dtype=numpy.float32)
In[6]: imgArray2.shape
Out[6]: (2136, 3216, 3)
.
This is what I have for Vips so far...
In[1]: import numpy
In[2]: from gi.repository import Vips
In[3]: image = Vips.Image.new_from_file('43.jpg')
In[4]: image
Out[4]: <Image object at 0x7f0c9a66c5f0 (VipsImage at 0x338a190)>
In[5]: imgArray2 = numpy.asarray(image, dtype=numpy.float32)
Out[5]: ValueError: setting an array element with a sequence.
So I get that error at the end because I'm not pulling the data in the right format from the Vips Image object.