Making teeth purple in a picture (JES)
What am I doing wrong? I have been trying to create a program for hours to change this man’s teeth purple.
def makeColor(picture): red=getRed(px) green=getGreen(px) blue=getBlue(px) (128 - red, 0 - green, 128 - blue) red = makeColor(128) green = makeColor(0) blue = makeColor(128) for x in range (120, 164): for y in range(161, 156): currentPixel = pic.getPixel(x,y) if (distance(red, getColor(currentPixel)) < 165): currentPixel.setColor(replacementColor)
Follow
76.9k 14 14 gold badges 60 60 silver badges 81 81 bronze badges
asked Nov 16, 2015 at 6:07
Alexander Campbell Alexander Campbell
1 2 2 bronze badges
Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation. Minimal, complete, verifiable example and on topic apply here. We cannot effectively help you until you post your code and accurately describe the problem.
Nov 16, 2015 at 17:09
1 Answer 1
Sorted by: Reset to default
replacementColor has no value. Also, it appears that your code is looking for red things to turn purple, rather than the white of his teeth. Perhaps:
purple = makeColor(100, 0, 100) # darken the purple a bit white = makeColor(128, 128, 128) . if (distance(white, getColor(currentPixel)) < 165): currentPixel.setColor(purple)
Follow
answered Nov 16, 2015 at 6:38
Prune Prune
76.9k 14 14 gold badges 60 60 silver badges 81 81 bronze badges
Can you give me more input? I may not being the code right at all. I need to create a program to make the teeth in the photo attached, purple.
Nov 16, 2015 at 7:04
@AlexanderCampbell he means that you have not given any value to color purple. Give it some value and look for white color instead of red. He has given you code and explained what you are doing wrong. Don't know what sort of more input might some need after that
Nov 16, 2015 at 8:18
@stackoverflow.com/users/5566302/alexander-campbell: Repeating the high-level problem does not tell me where you are stuck. You wrote a program that does not run at all. I left you a comment above that links to pages to help you write a clear question. The code you provided does not run, due to the undefined variables. If it did run, it would not do what you want. Until you better explain what you're doing, I don't know how to help you. "Give me more input" is not a problem description.
A Highlights Reel of Inspiration
We love the challenge that lays in the seeming simplicity of a colour themed photo project. Because it’s not just about incorporating the specific colour – the image also needs to be a creative and beautifully eye-catching composition. So in that way, a colour themed photo project really does stretch your skills and creativity… and that’s exactly why our Advanced Grads embark on one every single month!
So June was purple, and this week’s highlights reel is a collection of ten of our faves from the challenge album! Enjoy!
Julianne Peter, Advanced Graduate
Sue Thorn, Advanced Graduate
Janey Peters, Advanced Graduate
Jypsie Cronan, Advanced Graduate
Julie Sinclair, Advanced Graduate
Kellie Hoffman, Advanced Graduate
Claire Roads, Advanced Graduate
Leeza Wishart, Advanced Graduate
Louise Harmston, Advanced Graduate
Diane Nicolson, Advanced Graduate
A Storyboard Project
Something we really love about a colour themed photo challenge is its potential to become a full blown creative project! Embark on taking a series of images with a view to framing them together in a storyboard. The images can be the same subject captured in different ways, or completely unrelated objects which tie together through the common use of colour.
Photos: Louise Harmston, Janey Peters, Leeza Wishart, Claire Roads
We hope this collection inspires you to get out with your camera and have fun shooting your own colour themed photo project!