Resize Background Image when Resizing Window in p5.js?

I’m having trouble getting the background image for a p5.js sketch to resize along with the window resize function. Basically I’m preloading the image in the preload function, resizing it to match the current window width and height in the setup function, and attempting to resize the image in the windowResized function. But the sketch is neither loading the correct background image size nor resizing the image correctly when the window is resized. Is resizing the background image on window resize even possible in p5.js? Thanks!