
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
screenshot-with-selection
Advanced tools
A zero-dependency browser-native way to take screenshots powered by the native web MediaDevices API.
screenshot-with-selectionFork of @xataio/screenshot with enhancement of capture selected area This tool uses native browser APIs to take screenshots of a given web page, tab, window, or the user's entire screen.
Pick your preference. You can easily learn about this project in the following ways:
First, you'll want to install it:
npm install screenshot-with-selection
Then, you can add it to your app and use it like so:
import {
takeScreenshot,
checkIfBrowserSupported,
} from "screenshot-with-selection";
/**
* Only do this if your browser supports it.
* To check, visit https://caniuse.com/mdn-api_mediadevices_getdisplaymedia
*/
if (checkIfBrowserSupported()) {
takeScreenshot().then((screenshot) => {
/**
* This is a base64-encoded string representing your screenshot.
* It can go directly into an <img>'s `src` attribute, or be sent to a server to store.
*/
console.log(screenshot);
});
}
takeScreenshot accepts a few options to help you customize the user flow and the resulting image. These are:
| Option | Description | Required | Default Value |
|---|---|---|---|
quality | The quality of the final image on a scale of 0 to 1. 0 is lowest quality, 1 is highest. | nope | .7 |
onCaptureStart | An async function that does stuff when the capture starts. You'll usually want to hide any modals or anything here. | nope | |
onCaptureEnd | An async function that does stuff after capture ends. This is usually when you'll want to clean up. | nope | |
type | What kind of image do we want? Possible values are "image/jpeg", "image/png" and "image/webp". | nope | "image/jpeg" |
soundEffectURL | Why not play a little camera click sound effect when taking a screenshot? | nope | - |
height | Height of selection area or the area you want to capture | nope | - |
width | Width of selection area or the area you want to capture | nope | - |
x | coordinate x of the starting point of selection area or the area you want to capture | nope | - |
y | coordinate y of the starting point of selection area or the area you want to capture | nope | - |
You're always welcome to open an issue if you encounter any, or even better, open a PR directly to solve issues. We don't (yet) have more contributing guidelines than this because the project is quite small. This may change as things develop.
Forked with ❤️ in India.
FAQs
A zero-dependency browser-native way to take screenshots powered by the native web MediaDevices API.
The npm package screenshot-with-selection receives a total of 1 weekly downloads. As such, screenshot-with-selection popularity was classified as not popular.
We found that screenshot-with-selection demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.