You can use CSS to make this happen, and use passage tags to control it. Relevant documentation. CSS backgrounds.
Example. Assume the tag you want to use is "forest."
in story stylesheet
background-size: cover; /* maybe contain, based on the image and goals */
Then, to use it add the passage tag "forest" to any given passage.
This should work fine with GIF files.