Create function with closure parameter to determine pixel