Asking just because I’m curious… why are you using xpath?
I'm using a service called FreshRSS that automatically fetches RSS feeds. It has a feature that allows you to create custom feeds for sites by scraping the HTML with user specified XPath expressions.
I know that this isn't exactly "web development", but it uses webdev tools, and I wasn't entirely sure where else to post this.
If you’re rendering the page (in a browser, e2e test-runner, spider bot, etc…), have you considered running some js on the page to get the image? Something like: const imagePath = document.getElementById('exampleIdOnElement').style.backgroundImage
JS is, unfortunately, not possible here. I can only use XPath expressions.