Closed redwarp closed 3 years ago
Thanks for the issue! I didn't know this was broken.
It looks like a problem upstream in the image
crate. Recently, the png
module was moved into a codecs
module so instead of the path being image::png
, it's now image::codecs::png
for the errors you've received. I've submitted an issue for that in image
. When installing from cargo, it tries to grab image version "0.23.11"
so it fails. When checking out this repo, I've checked in a Cargo.lock with image version "0.23.6"
so the build succeeds.
In the meantime, I'll try to update the dependency and offending lines of code. I can push out a new version of this crate when I get the time since I don't like the idea of the crate being broken on crates.io.
I've published version 0.3.4 to crates.io. I was able to install it successfully. :slightly_smiling_face:
Compiling palette_derive v0.5.0
Compiling structopt v0.3.20
Compiling kmeans_colors v0.3.4
Finished release [optimized] target(s) in 56.01s
Installing C:\Users\user\.cargo\bin\kmeans_colors.exe
Installed package `kmeans_colors v0.3.4` (executable `kmeans_colors.exe`)
I greatly appreciate the report. This same issue prevented another crate of mine from installing, but I've fixed that. I wouldn't have spotted this for a while.
Thanks for the quick fix! I tried and it works flawlessly. I'm closing this issue then.
FYI : there is something really cool about running your app through some of my random pictures like
It was a lot of fun to write but more fun to see the results. I've had some thoughts about adding a dithering module to this crate for aesthetics.
A crate I finished recently works well with this crate https://github.com/okaneco/rscolorq. It's in a similar family of algorithms as k-means but dithers based on the pixels around it. It's fairly computationally expensive and doesn't have as clean of convergence criteria, but I like making images with it too. I threw your image into kmeans_colors, then piped the colors into rscolorq and a 50% size copy of the image. It's best to view at full size.
kmeans_colors -i github.jpg -p --no-file
# 13110e,2c2b28,472218,595139,b72c19,748b88,c08d63,dbe4dd
rscolorq -i github.jpg -o github-8c.png -c 13110e,2c2b28,472218,595139,b72c19,748b88,c08d63,dbe4dd
And with letting the program find the colors, I've noticed it has some weakness sometimes due to initial choices or lower image contrast.
rscolorq -i github.jpg -o github-8-auto.png --iters 4 --auto
You... do really cool stuff! It's amazing, I was actually thinking about how to have some nice effect like in the game Return of the Obra Dinn. You could not be more on point! I'm gonna use your rscolorq app and try a few things! Thanks for sharing!
kmeans_colors.exe -i '.\Japan 01-08-2013 20-54-35.jpg' -k 4 -p --no-file
# 181412,514133,af3b21,bcc3b8
rscolorq.exe -i '.\Japan 01-08-2013 20-54-35.jpg' -c 181412,514133,af3b21,bcc3b8 -o tokyo.png
It looks just great!
That does look nice. I like that the algorithm has a sort of chunky, high-ISO film grain look when viewed from a slight distance.
If you're interested in Obra Dinn, I know there are some dev blogs about the dithering used. It seems like a blue noise lookup texture on a sphere was used, and there was a temporal aspect that needed to be overcome from player movement (not to mention scaling for different resolutions).
(404'd link in the first post) https://web.archive.org/web/20140214164527/http://home.comcast.net/~ulichney/CV/papers/1993-void-cluster.pdf https://forums.tigsource.com/index.php?topic=40832.msg1045205#msg1045205 https://forums.tigsource.com/index.php?topic=40832.msg1363742#msg1363742
Thanks for the links! Things like that is one of the reason why I decided to learn rust in the first place: to manipulate image data, and write some algorithm, things I really don't do in my android dev daily job. I'll take a close look at the articles. Let me know if you want some helps for some basic tasks!
Wanting to try your tool, I ran
cargo install kmeans_colors
. It started to download and build the version 0.3.3 from crate.io.But it ultimately failed, with the following errors:
If I check out the repo, building works fine though. So my hunch is that what is published on crate.io might be broken?