Early filmmakers who made films in and about Spain used Andalusia as a stand-in for all of Spain, and had three favorite tropes for representing what they considered to be typically Spanish: Flamenco dancers, bullfighters, and bandits. The opera Carmen (and the novel it is based on) perfectly emblematizes these stereotypical archetypes.
Here are some paintings and post cards that, given their similarity to the staging in the films, probably influenced early filmmakers filming in Spain. The first is Un baile de gitanos en los jardines del Alcázar, delante del pabellón de Carlos V, painted in 1851 by Alfred Dehodencq :
And, by Juan García Ramos, Un baile para el señor cura: