-
Notifications
You must be signed in to change notification settings - Fork 615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limiting the Colour Palette #70
Comments
Hacky: Before returning a color on this line... https://github.com/fogleman/primitive/blob/master/primitive/core.go#L33 ...return a different color instead, perhaps by choosing the nearest from a palette. For example, you can add this snippet before the return statement: if r > 128 {
r = 255
} else {
r = 0
}
if g > 128 {
g = 255
} else {
g = 0
}
if b > 128 {
b = 255
} else {
b = 0
}```
...and it does a decent job. (best if you let it choose alpha with `-a 0`) |
woah; that's really clever - thank you! |
Sorry; i'm super new to go, but those changes don't seem to have any affect; here's my code:
i imported fmt at the top and everything; do i have to recompile the program or something for it to change? This is literally the first time i've ever used go... |
Use |
I've been doing that - as a test i tried changing that last line to |
?? |
Dunno dude, it worked for me. |
Could you please detail what commands you ran after editing the file? Did you just do |
Yeah that's it. Show me what you tried. |
I'm at work right now but once i get home in a few hours I'll post a comment with my whole core.go file and the stuff I've tried. Thanks x100 for helping me out |
Hi! I've the same problem as @robbiebarrat - sollution that you add in comment above have no effect, but what I'm trying to do is convert monochromatic, grey-scalled image into also monochromatic picture, but e.g. red-scalled (I'm not sure if such thing even exist in english 😃 ) @robbiebarrat, @fogleman - did you find sollution that worked for you guys? EDIT: |
Is there any way to specify a list of available colours? E.g. if I only wanted it to draw with primary colours; (red, yellow, and blue), could I specify this?
Would it be able to learn to mix the available colours and better approximate an image that uses more colours?
I'm totally open to all solutions; even the extremely hacky - thanks.
The text was updated successfully, but these errors were encountered: