Chrome Extension Take Screenshot of Specific Element
00:17 02 Feb 2024

I am making a chrome extension that can take a screenshot of a specific element, however, I am not sure how to take a screenshot ONLY of that element because captureVisibleTab takes a picture of the whole tab.

I tried using getBoundingClientRect to crop the bigger screenshot to the page, however it is giving incorrect values and doesn't work properly. I also tried using html2canvas however I had trouble using the library in an extension.

javascript google-chrome-extension