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

Requesting pngs as gray or monochrome #511

Open
gvasold opened this issue Sep 17, 2020 · 1 comment
Open

Requesting pngs as gray or monochrome #511

gvasold opened this issue Sep 17, 2020 · 1 comment

Comments

@gvasold
Copy link
Contributor

gvasold commented Sep 17, 2020

I noticed that requesting quality "bitonal" or "gray" from a PNG source (and also some TIFF source images) as a PNG results in RGBA instead of the expected gray or bitonal. I wrote 4 tests to show this behaviour, starting here: https://github.com/gvasold/loris/blob/fa7114fac6ebff2e2d01b0bc9de97bd87b5e9051/tests/transforms_t.py#L325

I also tried to fix this (the fix is commented out to make my tests fail): https://github.com/gvasold/loris/blob/fa7114fac6ebff2e2d01b0bc9de97bd87b5e9051/loris/transforms.py#L171

These changes make my new tests pass, but fail the existing test test_convert_to_bitonal_with_rotation_is_mode_LA
(https://github.com/gvasold/loris/blob/fa7114fac6ebff2e2d01b0bc9de97bd87b5e9051/tests/transforms_t.py#L320) which makes me wonder if a bitonal image should really have mode LA (I'd expect mode '1', but maybe there's something I missed).

@bcail
Copy link
Contributor

bcail commented Sep 17, 2020

@gvasold you may very well be right. Feel free to open a PR, if you want. I won't be able to look at this for a while, but maybe @alexwlchan can, or I can later.

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

No branches or pull requests

2 participants