Replies: 2 comments
-
Hi @DDoS, I think enlarging the output would mean that a pixel could be written more than once at overlaps, which wouldn't work. You need a dither algorithm with limited context, ie. each output pixel can be computed from a bounded set of input pixels, ie. you have some term that stops errors being diffused too far. Now you can just enlarge the input by the appropriate amount and compute the output area. libvips has a built-in dither, I guess you saw? If you save a GIF or an 8-bit PNG it'll be dithered for you:
To make a 16-colour dithered PNG: |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick reply. I hadn't noticed the dither support, looks like it's a private API? I need to use a custom palette and in Lab space. Anyway I decided to ditch |
Beta Was this translation helpful? Give feedback.
-
For an operation I'm trying to implement I need to write multiple pixels for each input pixel (error diffusion). I saw mentioned in the doc that you can change the size of the input region, but can that also be done for the output region? Is there a way to make sure that the
out_region
is always NxM pixels bigger than the input region?Really I just want to implement "Floyd–Steinberg" dithering, and I'm not sure who to correctly write to neighbouring pixels.
Beta Was this translation helpful? Give feedback.
All reactions