You can make use of canvas
element to get the visible part of a background image of an element as a base64 string in JavaScript. Below is the code snippet that performs this task:
index.tsx1046 chars23 lines
You can call the above function by passing the element for which you want to get the visible part of the background image.
gistlibby LogSnag