Webrequest: context for blocked images

When I use webrequest API to block images, the handler gets called for both image tags (<img>, <picture> etc.) tags and CSS background images. I want to block the former but allow the latter. Is there any context information accessible from the handler that’d let me distinguish between the two types of images?

It’s not completely reliable for various reasons, but might help: background images specified in an external CSS file may have a different HTTP_REFERER header address (typically ending with .css) than requests generated by the page.