-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Description
from PIL import Image
import pyarrow as pa
arr = pa.array([0]*(5*5*4), type=pa.uint8())
im = Image.fromarrow(arr, 'RGBA', (5, 5))- Python 3.13.2 (tags/v3.13.2:4f8bb39, Feb 4 2025, 15:23:48) [MSC v.1942 64 bit (AMD64)] on win32
- Pillow 11.2.1
- pyarrow 19.0.1
Traceback (most recent call last):
File "C:\Users\...\main.py", line 4, in <module>
im = Image.fromarrow(arr, 'RGBA', (5, 5))
File "C:\Users\...\AppData\Local\Programs\Python\Python313\Lib\site-packages\PIL\Image.py", line 3373, in fromarrow
_im = core.new_arrow(mode, size, schema_capsule, array_capsule)
ValueError: Invalid Arrow array mode or size mismatch
Is there any special version required?
Workaround: the following seems to work:
from PIL import Image
import pyarrow as pa
mode = "RGB"
size = (1920, 1080)
img = Image.new(mode, size=size, color="grey")
pa_img_arr = pa.array(img)
pa_img = Image.fromarrow(pa_img_arr, mode, size)
pa_img.save("pa_img.jpg")aclark4life
Metadata
Metadata
Assignees
Labels
No labels