![]() Registered Member ![]()
|
A filter layer to quantise colours to fit a user specified palette.
Would be nice for keeping pixelart palette conforming. Now that palettes can be stored in document won't need to rely on an external palette. |
![]() Registered Member ![]()
|
Oh... yes that would be incredible. I wonder how feasible it would be though?
|
![]() Registered Member ![]()
|
I'm working on it at the moment.
So far got the basic palettization working fine. Using a boost::geometry rtree to accelerate palette search, so it's speedy enough. Want to add some dithering options yet, if I can figure out how to do so to my liking. |
![]() Registered Member ![]()
|
WOW that's pretty awesome!!! <:0 Thank you so much for doing this ♥️
|
![]() KDE Developer ![]()
|
I was thinking of reworking the index-colors filter for this, as it was originally designed for that, maybe you can find some inspiration there? It was written by Manuel Riecke/MrBeast who is(was) an OpenGameArt regular ![]() |
![]() Registered Member ![]()
|
My motivation is much the same I think, HD index painting, but I'm not keen on the automatic palette generation's lack of individual colour control. It looks to be brute-forcing palette search, but does calculate the colour distance in the Lab colourspace. Using boost::geometry rtree's built-in euclidean distance rather than the colourspace distance function as so far I haven't found a way to use a custom distance metric with rtree. I'm not very knowledgeable about colourspaces and at the moment I'm just comparing distance in RGB which I know isn't great. I know Lab is much better than RGB for this, but is it definitively the "best" colourspace for measuring colour distance, or should I just use the image colourspace? |
![]() KDE Developer ![]()
|
Using Lab is definitely the right choice.
|
![]() Registered Member ![]()
|
Got some simple dithering working. Just finds the two nearest colours and thresholds a pattern between them based on relative distances. Not super sure about it, but can produce some decent results.
DawnBringer 16 colour palette and 4x4 bayer pattern: http://img.uninhabitant.com/Screenshot_20190608_205106.png |
![]() KDE Developer ![]()
|
|
![]() Registered Member ![]()
|
Got the GUI basically done, just got a semi-problem with configuration not being saved when first creating a filter layer. Updating the configuration on property widget changes hides this quite reliably, but still the problem is there.
Turns out the PAT format patterns which I thought were 1-bit are actually RGBA, so to use them I added a "use alpha" option, but otherwise uses pattern colour lightness. Also added a noise dither option as already had it for testing. http://img.uninhabitant.com/Screenshot_20190609_132501.png |
![]() Registered Member ![]()
|
Put an initial patch up on Phabricator if anyone wants to try it: https://phabricator.kde.org/D21682
|
Registered users: Bing [Bot], claydoh, Evergrowing, Google [Bot], rblackwell