Skip to content

Add support for flat uint8 arrow arrays for multi channel images #8908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

wiredfool
Copy link
Member

Fixes #8907 .

Changes proposed in this pull request:

  • Support for flattened arrays of the form [r,g,b,a,r,g,b,a....] in Image.fromarrow
  • Tested support for uint32 whole pixels into the multichannel images in Image.fromarrow

("HSV", UINT, [0, 1, 2]),
),
)
def test_fromarray(mode: str, data_tp: tuple, mask: list[int] | None) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def test_fromarray(mode: str, data_tp: tuple, mask: list[int] | None) -> None:
def test_fromarray(
mode: str, data_tp: tuple[Any, list[int] | float, int], mask: list[int] | None
) -> None:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To channel Raymond Hettinger -- Why not a named tuple?

("HSV", INT32, [0, 1, 2]),
),
)
def test_from_int32array(mode: str, data_tp: tuple, mask: list[int] | None) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def test_from_int32array(mode: str, data_tp: tuple, mask: list[int] | None) -> None:
def test_from_int32array(
mode: str, data_tp: tuple[Any, int, int], mask: list[int] | None
) -> None:

@wiredfool wiredfool changed the title Add support for flat uint8 arrays for multi channel images Add support for flat uint8 arrow arrays for multi channel images Apr 21, 2025

UINT_ARR = DataShape(
dtype=fl_uint8_4_type,
elt=[1, 2, 3, 4], # array of 4 uint 8 per pixel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
elt=[1, 2, 3, 4], # array of 4 uint 8 per pixel
elt=[1, 2, 3, 4], # array of 4 uint8 per pixel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image.fromarrow minimal example does not work
2 participants