Sam Nardoni
Sam Nardoni
MModular
Created by Sam Nardoni on 1/7/2024 in #questions
Mojo Pointer to Python bytes?
Hello, Is there a way to create a Python bytes object from a Mojo Pointer? Context: I have image/pixel data stored in contiguous memory in Mojo-land. I want to load this into Python-land using pillow. Pillow offers a Image.frombytes function, which seems like it may do the job. But I need to provide it a Python bytes. I don't mind if the data is copied. I've tried setting the data pixel-by-pixel, but it is sssllloooowwwww.
2 replies