Function to scramble images