We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm trying to add simple filters like sepia or black and white onto an uploaded image, but I'm having trouble applying the same colour change to all the pixels while preserving the original image.
Answers
Is there a specific reason that you don't want to use tint()?
What about lerpColor()?
my prof specified that we have to apply a filter from scratch, so none of the built-in functions
Do you have course material on how tint functions, color filters, or colorspaces in general work? Have you read the color tutorial, or looked at set() or colorMode()?
I went through all of those, I still haven't found anything that can help me create something like a sepia filter. this is what I have:
img = None
def setup(): global img size(500, 336) img = loadImage("tsunami copy.jpg") image(img, 0, 0, 500, 336) loadPixels() for i in range(width*height): pixels[i] = color(188, 133, 65) updatePixels()
I've changed the colours of the pixels, but it doesn't create the filter I'm trying to do.
Seems like you are assigning the same color to every pixel. Maybe try getting the color of each pixel of the image and then change it? Using a B&W filter as an example, you might want to get the brightness of the color of each pixel, and, depending on how bright it is, either replace it with a black or a white pixel.
how would I do all of that?
@kkl18 -- TfGuy44 said:
So try "getting the color"
"of each pixel of the image"
"and then change it"