11 Replies Latest reply on Jan 7, 2012 12:13 AM by SteveEdwards555

    Set each pixel randomly to one of five pre-defined colors

    SteveEdwards555 Level 1

      Hi

       

      I'm trying to write a script that sets each pixel, randomly,  to one of five pre-defined colors.

      Not much experience with PS scripting, but I'm a C++ programmer so kinda know the steps I need to do:

       

      • Create an array of color variables that hold my colors

      • Loop through each pixel, choose a random number 0-4 to act as an index into the array

      • Set pixel color to the value of the randomly chosen array variable.

       

      I'm struggling to find the correct setup code/syntax to put this in to action, though!

       

      Could someone help out with looping through either 'All' or a selection, pixel addresses, and the syntax for assigning color value to a pixel address.

       

      Thanks

       

      Steve