Inserting Images from a Database

I’m working on a project that involves inserting multiple pictures throughout the duration of an IAT. Is there a way to refer pictures randomly from a database?

PsychoPy needs a filename for images.