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

jpeg8_encode fails when specifying bitspersample #116

Closed
erikogabrielsson opened this issue Oct 7, 2024 · 1 comment
Closed

jpeg8_encode fails when specifying bitspersample #116

erikogabrielsson opened this issue Oct 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@erikogabrielsson
Copy link

Hi,

With 2024.09.22 this simple use of jpeg8_encode fails:

from imagecodecs import jpeg8_encode
import numpy as np

data = np.zeros((128, 128), dtype=np.uint8)
jpeg8_encode(data, bitspersample=8, lossless=False)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[15], [line 5](vscode-notebook-cell:?execution_count=15&line=5)
      [2](vscode-notebook-cell:?execution_count=15&line=2) import numpy as np
      [4](vscode-notebook-cell:?execution_count=15&line=4) data = np.zeros((128, 128), dtype=np.uint8)
----> [5](vscode-notebook-cell:?execution_count=15&line=5) jpeg8_encode(data, bitspersample=8)

File imagecodecs\\_jpeg8.pyx:161, in imagecodecs._jpeg8.jpeg8_encode()

ValueError: invalid bitspersample=8

Maybe this check is not as intended?
https://github.com/cgohlke/imagecodecs/blob/master/imagecodecs/_jpeg8.pyx#L157

@cgohlke cgohlke added the bug Something isn't working label Oct 7, 2024
@cgohlke
Copy link
Owner

cgohlke commented Oct 7, 2024

Thanks for reporting! That case should of course work. It looks like a regression introduced in #105. The fix is going to be in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants