Philipp Metzner <philipp.metz...@tum.de> writes:

> Hi all,
>
> I created an |pyopencl.Image| object via:
>
> |importpyopencl ascl importnumpy asnp ctx =cl.create_some_context()image 
> =cl.image_from_array(ctx,np.ones((16,16),dtype=np.uint8))|
>
> How can I obtain the image channel type information (here, 
> |cl.channel_type.UNSIGNED_INT8|)? I want to implement a generic 
> downloading function that returns a numpy array given an |Image|.
>
> I tried two approaches:
>
> Using |Image.element_size| gives me the byte size of a single element, 
> however I can't map the element size to a data type (float32 and int32 
> have the same element size, for instance).
>
> |Image.format| returns a |cdata 'struct _cl_image_format &'|. Querying 
> either of the fields |image_channel_data_type| and |image_channel_order| 
> returns 0, the default values of the ImageFormat constructor.
>
> Or do you recommend a different approach (using Array, f.i.)?

That was a bug. Fixed in git:

https://github.com/pyopencl/pyopencl/commit/87fec9cba500a6aff47b7c0367c7663b4938404f

Thanks for the report!

Andreas

_______________________________________________
PyOpenCL mailing list
PyOpenCL@tiker.net
https://lists.tiker.net/listinfo/pyopencl

Reply via email to