Open gvasold opened 3 years ago
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).
test_convert_to_bitonal_with_rotation_is_mode_LA
LA
@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.
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 modeLA
(I'd expect mode '1', but maybe there's something I missed).