3 ms·
We had another dithering post a few days ago and nobody answered my question... I'm reposting in case someone who comes here knows the answer: "Does anyone kno
by glimshe 1y ago
We had another dithering post a few days ago and nobody answered my question... I'm reposting in case someone who comes here knows the answer:
"Does anyone know of any application/tool that can perform palette dithering? The idea is "here is a n-color palette specified in their RGB values, here is the full-color RGB image, give me the best possible dithered image using the provided palette". The tools that I've used were underwhelming and produced results full of banding and artifacts.
Basically, great dithering in color instead of B/W."
EDIT: Thank you for the answers! I'll check all links.
- gyomu 1y agoThat’s going to be a tricky problem full of compromises, and entirely up to how you formalize your definition for “the best possible dithered image”. Do you care about preserving relative brightness, contrast, edges,… etc. Human color perception is tricky, and in the outline you give it’s entirely possible that the provided n-color palette (also, what order of magnitude n are we talking about here?) would be inadequate for a satisfactory rendering of the provided full color image.
- glimshe 1y agoI'd just like a subjectively "good" result that beats the manual approaches using image manipulation programs. n would be less than 4096, but usually much smaller values (256, 16)
- tfinch 1y agoI’m using this for making some quake inspired textures - it’s a bit clunky but works for me https://captain4lk.itch.io/slk-img2pixel https://captain4lk.itch.io/slk-img2pixel
- kevinsync 1y agoI left a comment [0] on the other thread, and this is irrelevant if you aren't using Photoshop, but there's a plugin called DITHERTONE Pro that gives you a lot of control over the dither algorithm used + color grade. For actual design, I tend to use this since I'm already in PS cobbling together an image, and you can tweak the results in realtime to dial it in how you want. I also have used didder [1] a couple times for dithering via CLI / script. Its results can be pretty good too, just more for repeatable batch operations and you need to make sure your palettes and chosen algorithms will produce what you're actually looking for. [0] https://news.ycombinator.com/item?id=45726845 https://news.ycombinator.com/item?id=45726845 [1] https://github.com/makew0rld/didder https://github.com/makew0rld/didder
- rikroots 1y agoI responded in that post (though not to you, and probably not what you're after) with a link to my JS canvas library's "reduce palette" filter. It includes both supplying an array of colors to act as the palette, and setting the required number of colors for which the filter can calculate a "commonest colors" palette, calculating color distances in the OKLAB color space - https://scrawl-v8.rikweb.org.uk/demo/filters-027.html https://scrawl-v8.rikweb.org.uk/demo/filters-027.html If anyone wants to see the filter code, it in the GitHub repo here: https://github.com/KaliedaRik/Scrawl-canvas/blob/064469928a30c8641f0a2f26ea39f68d412f370c/source/helper/filter-engine.js#L4748 https://github.com/KaliedaRik/Scrawl-canvas/blob/064469928a3...
- snvzz 1y agoThe gimp can do this. Define your palette, then via the dialog spawned through image->format menu, pick your palette from the list.
- glimshe 1y agoYes, but the algorithm isn't that great... That's what I'm using now
- snvzz 1y ago"Positional" is a single, relatively boring hardcoded pattern, and the other options are Floyd–Steinberg error diffusion. I do agree it would be nice to extend gimp to do all sorts of fancy dithering, and imagine it's just that nobody has put on the work yet.
- kragen 1y agoFloyd–Steinberg is pretty great when your palette has reasonably-close colors.
- snvzz 1y agoIn my own experience playing with dithering, generating a palette is often harder than the dithering itself.
- kragen 1y agoHeckbert's median-cut algorithm usually does a great job. See https://web.cs.wpi.edu/~matt/courses/cs563/talks/color_quant/CQindex.html https://web.cs.wpi.edu/~matt/courses/cs563/talks/color_quant.... There's probably something improved since then, though.
- snvzz 1y agoThat's cool, and resembles my own approach, which I'll reevaluate and polish now :)
- mpyne 1y agoUse Google's Squoosh.app: https://squoosh.app https://squoosh.app When editing an image you can choose the 'Reduce palette' option to bring up a way to reduce the number of images used, and the palette reduction panel will let you optionally apply dithering or not. The dithering algorithm is not selectable but it's worth trying to see if you like it.
- agarv 1y agoI don't know if it's exactly what you're looking for but I made a free tool https://app.dithermark.com https://app.dithermark.com . It only allows 18 colors max, but it has a lot of options, including the ability to determine what color palette to use.
- kragen 1y agoThis is common functionality in graphics software, but there isn't such a thing as "the best possible dithered image using the provided palette"; there are unavoidable tradeoffs between sharpness and color precision, so different ways of dithering may be better for different purposes.
- ftigis 1y agoImageMagick with `-dither` and `-remap` could also work. For remap you would need an image with your desired palette, and IIRC you could use ImageMagick to produce that image but I cannot recall the incantation required for that.