FabriceCastel / gvcci

color extraction to turn images into 16 color palettes
MIT License
109 stars 6 forks source link

Moar bugs! :D #9

Closed nan0s7 closed 6 years ago

nan0s7 commented 6 years ago

There's a spelling error when you echo the colour codes to the terminal. You spelt "background" wrong - it says "backgorund" ;P

Also it seems like extract.py doesn't output the template I use anymore. Unless you changed the command and I didn't notice....

Have a good day! :D

FabriceCastel commented 6 years ago

Thanks for the find, totally missed that typo.

I made some changes to the script that now output files in a better way (or at least I like to think it's better). If you run the script on 1440938669003.jpg with --template templates/iterm.plist you'll see these two lines at the end of the stdout output.

Output: ~/.gvcci/themes/1440938669003/wallpaper.jpg
Output: ~/.gvcci/themes/1440938669003/iterm.plist

The idea is to store generated themes in the ~/.gvcci/themes directory and have each theme be a dir (named after the source image file) containing the image itself (renamed to wallpaper.[extension]) and whatever templates you asked it to fill out.

I'm doing this so that when you generate themes, you can go back and apply them independently of the generation step. I haven't added this yet but I'll be building (and probably splitting out) a separate "apply theme" type of tool so that the generation of themes based off an image and the application of the wallpaper + theme are separate steps. That'll allow people to export and share themes more easily and could make for a better ricing tool overall ^-^

The issue itself is resolved but I'll leave this issue open so you can get a chance to respond and let me know what your thoughts are about this.

nan0s7 commented 6 years ago

Aha! I see. I did see the output commands, but I had a bug in my program where if it didn't get new colour codes from GVCCI, it'd just use the last-calculated codes. So it took me all day to realise that I wasn't actually getting new colours each time...

To be honest I was thinking of doing a similar thing with my script but now that you've done it, I don't have to! I like the idea for sure. Although I was worried about something - well, two things; one is how it handles doing the same wallpaper again. Because some people may like the previous colour codes (if they decide to calculate them again) compared to the one they just did. Two would be if they perform the calculation for a lot of wallpapers, trying to find the best theme, that directory would quickly become large especially due to the stored images.

For the first problem, maybe store a backup of the previous codes only in the same folder (so you'd have to check if they'd already run that certain picture through previously).

For the second problem, I was wondering if it'd be possible to add an argument to ONLY output the template with the codes. Or have some sort of limit to how many wallpaper codes and images and whatever else you decide to store there.

For the wallpaper applying thing, I'd suggest making another repo just to keep dependencies and cleanliness good.

I was thinking about extending my script to be able to be used for basically every terminal I can find. I dunno if you've been looking at my applier script but I've been working at adding support for urxvt, and it's basically finished now - I just need to update it to work for your new storing location. I'd probably merge some stuff with Gogh too, and additionally have the ability to automatically change to the new theme like you wanted to as well.

So if you wanna join forces with that, let me know. Anyway, feel free to close this issue now and don't forget you can make issues on my code when you break them in the future ;P, keep up the good work!

FabriceCastel commented 6 years ago

Ideally the output would always be the same (or at least close enough) for a given image that running it through again shouldn't matter. Right now things are still changing a bunch though, and since the core algorithm is continually being improved I do want to have the generated themes always be a reflection of the latest gvcci :p

The theme folder size is a good point. Not sure how to address it yet but I'll keep it in mind. Could have a thing where - like you said - you don't copy the image over. Maybe I could symlink it or something.

For the applying well, I did just make another repo haha. Here. https://github.com/FabriceCastel/gvcci-apply

You can see how I'm trying to set this up to handle more environments and terminals/applications in the future. It's just barely set up though.

I had a look at your work. It doesn't look like a trivial drag & drop into the gvcci-apply repo but when I have more time it would definitely be a worthwhile bit of logic to add in as part of the "apply theme" portion of this effort.