Skip to content
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

Python: Direct support for 'half' using numpy.float16 type #2694

Merged
merged 1 commit into from Sep 3, 2020

Conversation

lgritz
Copy link
Collaborator

@lgritz lgritz commented Sep 3, 2020

When transferring blocks of pixels (for example, by ImageInput.read_image
or ImageOutput.write_image), "half" pixels ended up mangled into uint16,
the only type of the right bit width.

But NumPy has a numpy.float16 type! A little bit of extra hinting to
pybind11 makes this work as users probably expect.

Fixes #2689

Signed-off-by: Larry Gritz lg@larrygritz.com

When transferring blocks of pixels (for example, by ImageInput.read_image
or ImageOutput.write_image), "half" pixels ended up mangled into uint16,
the only type of the right bit width.

But NumPy has a numpy.float16 type! A little bit of extra hinting to
pybind11 makes this work as users probably expect.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
@lgritz
Copy link
Collaborator Author

lgritz commented Sep 3, 2020

Reported on #2689 that this solves the problem. Merging.

@lgritz lgritz merged commit ce6ac37 into AcademySoftwareFoundation:master Sep 3, 2020
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request Sep 3, 2020
…ftwareFoundation#2694)

When transferring blocks of pixels (for example, by ImageInput.read_image
or ImageOutput.write_image), "half" pixels ended up mangled into uint16,
the only type of the right bit width.

But NumPy has a numpy.float16 type! A little bit of extra hinting to
pybind11 makes this work as users probably expect.

Fixes AcademySoftwareFoundation#2689

Signed-off-by: Larry Gritz <lg@larrygritz.com>
@lgritz lgritz deleted the lg-numpy branch September 3, 2020 23:47
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.

[BUG] Python: InputImage.read_image() returns ndarray of dtype uint16 for TypeHalf
1 participant