Open pngwn opened 1 year ago
This is far more involved than I first thought, will need a completely custom implementation. Antialiasing cannot be disabled at all for canvas which makes sense jn principle but is still annoying.
I wonder if we can do it in Python as part of the postprocessing, via a top_k_colors
parameter (cc @apolinario)
I wonder if we can do it in Python as part of the postprocessing, via a top_k_colors parameter (cc @apolinario)
IMO that may be a sub-optimal solution for the following reasons:
1) The developer may not know how many colors the users are going to draw in their segmentation mask - so there would need to be a heuristic to try to detect which colors are masks and which are edges
2) I'm actually experimenting with doing this on post-processing myself while we don't have this, and top_k_colors
sometimes behave sub-optimally - for example in a demo like this below - in a color with a lot of surface area sometimes an anti-aliased red would get a higher frequency (and would get into the top ranking) than a small mask (like the purple one in this case)
This should be possible with the new ImageEditor, the only reason i didn't add it is that I didn't have time to confirm that it worked as expected.
Is your feature request related to a problem? Please describe.
We anti alias sketch lines so they look pretty which is nice for freehand sketches but not so nice for masks/ segmentation maps.
Describe the solution you'd like
It would be nice if the application author could disable the anti-aliasing behaviour.
Additional context
Current behaviour
Usecase