There's two ways I can think of off the top of my head I would probably try this.
The first would be to name the files so that they relate to the color choice in the survey. For example, if the color question was Q14 and first answer my question was Red, then I would make all my red pictures be something like PicA1.jpg, PicB1.jpg, PicC1.jpg. Then where I wanted the images, I would try something like PicA[%Q14%].jpg. The script will read the answer for Q14, replace it with 1 if I chose red, and the resulting HTML would be PicA1.jpg.
The second option would be to build a list with all the HTML to display the images in different colors. Then I would use some perl to say "If Q14=1, add list items 1-10, if Q14=2 then add list items 11-20" and so forth. Then where I want to display the actual images, I would just put [%ListLabel(ConstructedListName,1)%] to display the first image.