Closed haras-unicorn closed 1 year ago
Oh that is funny! As far as I know, kmeans-colors
is indeed slow but is great.
What kind of changes would you need so you can integrate this with lulezojne?
Also, FYI, I notice that somehow my implementation does not work on a M2 mac (it gets stuck forever) and I have not yet taken the time to see what needs to be adressed.
Also, I want to highlight that, it's true that using kmeans obtain amazing results, but there are definitely some faster algorithm out there that also achieve great results, like octrees (https://en.wikipedia.org/wiki/Octree), median cut (https://en.wikipedia.org/wiki/Median_cut) I have not tested this lib: https://crates.io/crates/iris-lib but it probably is really fast compared to kmeans clustering
Oh, I get it know, you are asking me if I would considering publishing a crate? It has been on my mind for some times, I am a bit stuck because of my pre-processor code that does stuff on shader. So I would also need to publish the pre-processor as a crate so it can be used, or somehow skip this step before assembling a crate. Anyway, a bit of work there to be sure.
Thank you for the recommendations! I'm going to look at those and implement them for lulezojne
.
Yes, I'd like to publish your code as a crate.
Sorry if I'm being ignorant but why would your pre-processor need to be a separate crate?
I don't remember 😂 (I was looking into it over a year ago I think) but it does. I'll take a look this week-end and let you know.
If you check my different cargo.toml file, you can see that they all have keywords and everything set for publishing, I just never did it. So I guess you are motivating me to take a look again.
Yea I guess xd
Anyway I'll look into it as well and try putting it all in one crate.
Please let me take care of it 😉
I'm almost there, I solved most issues. But I figure I need a new name for this crate!
a new name?
Yep. This crate is named kmeans-color-gpu right now but it's inaccurate: the create does colour reduction with kmeans, but also with octree It also does colour replacement, dithering. So kmeans does not really represent what it does.
uhh something like color-gpu? i mean it does color manipulation using your gpu - i know theres more to color manipulation but idk how else to encompass all the features succinctly :/
Naming is hard :-)
yea :/ let me know when u have a name for it tho!
As I was not inspired, I kept the name and published the three crates https://crates.io/crates/kmeans-color-gpu is probably the one you need to use. You can check the examples here https://github.com/redwarp/kmeans-gpu/tree/main/core/examples on how to integrate it with your own work, it should be straightforward! I know it works well on windows, does somehow fails on mac, have not tested on linux ;-)
You will want to use this method to extract the palette: https://docs.rs/kmeans-color-gpu/0.1.0/kmeans_color_gpu/struct.ImageProcessor.html#method.palette
woo tyvm! 🥳
Hello!
I'm writing lulezojne. It's a WIP pywal clone heavily inspierd by lule with templating support and some additional goodies. I'd like it if this was a crate I could use as a color extraction backend.
I'm currently using kmeans-colors and color-thief-rs for backends (which the user can select as is the case with pywal). The kmeans cpu implementation is slow (maybe im setting wrong arguments on it) and the colorthief backend only generates 16 colors max. I'd like to see how much performance I could get with this backend.
I could make a PR for it and all that's needed - I'm just asking to see if you are interested in something like that.