There are many chrome extensions to take a screenshot. But recently, I was working on a project where we had to build an extension and also were taking a screenshot. So apparently, chrome provides an API called ‘capturevisibletab’ (doc) and it works. While coding, I referred to this git repo which works perfectly.
But then, as we tested, we found the image was cropped when using a macbook retina display machine.
It took us a while to understand that this is because the devicepixelratio (window.devicePixelRatio) is 2 in a macbook(with retina) display and 1 in others and hence the issue.
Thus, we had to adjust for scale which we did not account for earlier and we referred to this code for adjusting it.
Will soon post our whole code for completeness but the logic is pretty clear from the above code.
Hope it helps !