This tool uses native browser APIs to take screenshots of a given web page, tab, window, or the user's entire screen.

Overview

Logo @xata.io/screenshot

This tool uses native browser APIs to take screenshots of a given web page, tab, window, or the user's entire screen.

Demos

Pick your preference. You can easily learn about this project in the following ways:

  • Watch an explainer on YouTube.
  • See it in action on StackBlitz. You'll need to open the preview in a new window to get around extra iframe security that StackBlitz needs.
  • Read about the details on the Xata Blog.

Usage

First, you'll want to install it:

npm install @xata.io/screenshot

Then, you can add it to your app and use it like so:

{ /** * This is a base64-encoded string representing your screenshot. * It can go directly into an 's `src` attribute, or be sent to a server to store. */ console.log(screenshot); }); }">
import { takeScreenshot, checkIfBrowserSupported } from "@xata.io/screenshot";

/**
 * 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 's `src` attribute, or be sent to a server to store.
     */
    console.log(screenshot);
  });
}

Options

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 -

Contributing

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.

Made with ❤️ in Berlin.

You might also like...

Harassment Manager is a web application that aims to empower users to document and take action on abuse targeted at them on online platforms.

Harassment Manager Online abuse and harassment silence important voices in conversation, forcing already marginalized people offline. Harassment Manag

Dec 6, 2022

Build your entire project with one command 🚀

Build your entire project with one command 🚀

Dev Template dt --template mvc No more installing and configuring all basic dependencies manually every time you start a new project. the dev template

Nov 8, 2022

The entire bee movie script, but in commit messages.

Project Name Project Description Live Version This page is not yet deployed. Feedback and Bugs If you have feedback or a bug report, please feel free

Oct 1, 2022

A simple but powerful tool to make your screenshots prettier.

A simple but powerful tool to make your screenshots prettier.

SnipSnap A simple but powerful tool to make your screenshots prettier. Motivation I built SnipSnap because I wasn't happy with the other options as th

Dec 16, 2022

✍️ A scratchspace for your new Tab page

✍️ A scratchspace for your new Tab page

Tab␣ A scratchspace for your new Tab A beautiful new tab replacement that gives you your very own scratch space to help you stay organized and focused

Jan 3, 2023

Share your screen to a projector with only a web-browser.

Share your screen to a projector with only a web-browser.

picklecast - Simple Screen Cast Receiver Screen share to a RaspberryPi or display computer connected to a projector or TV. Quickstart Install and star

Nov 17, 2022

Browser tab reload automation.

SpeedFeed Browser tab reload automation. Report Bug · Request Feature · View License (back to top) Contributing Contributions are what make the open s

Aug 10, 2022

Obsidian plugin to open a note of your choice when creating a new tab, like in the browser.

Obsidian plugin to open a note of your choice when creating a new tab, like in the browser.

New Tab Default Page Obsidian plugin to open a note of your choice when creating a new tab, like in the browser. Usage Set the note to open in new tab

Dec 27, 2022
Comments
  • Option to skip waitForFocus

    Option to skip waitForFocus

    Thanks for a great solution for taking screenshots! I have a small feature request - is it necessary to always call waitForFocus before taking a screenshot?

    When taking a screenshot of the full screen, it's not obvious that you need to click back into the browser window to get focus and take a screenshot.

    I briefly tested a modified version and the screenshot is taken correctly even when I choose full screen (without waiting for focus).

    Can you please add an option to skip this waitForFocus call?

    opened by marekchovanec 1
Owner
xataio
Serverless Database for Jamstack and Low-Code
xataio
A server setup to take screenshots against the green screen in-game.

alt:V Clothing Green Screener Support on Patreon. Seriously. Ever want screenshots of every single clothing item in GTA:V? Well this is your repositor

null 13 Dec 26, 2022
Meogic-tab-manager is an extensible, headless JavaScript tab manager framework.

MeogicTabManager English document MeogicTabManager是一个有可拓展性的、headless的JavaScript标签页管理框架。 MeogicTabManager旨在提供可自由组装页面框架、自定义页面组件、甚至覆盖框架自带事件响应的开发体验。 Meogi

meogic-tech 5 Oct 8, 2022
aka Scaletor, take screenshots of a piece of a map and scale/compare with other parts of the map

scale-a-tron A quick-and-dirty map that lets you compare one area to another. Draw a shape around a region, zoom in to another place on the map, and c

Stamen Design 24 Nov 7, 2022
A JavaScript (and TypeScript) SDK for the ScreenshotOne.com API to take screenshots of any URL

jssdk An official Screenshot API client for JavaScript and TypeScript. It takes minutes to start taking screenshots. Just sign up to get access and se

ScreenshotOne.com 7 Oct 15, 2022
An application to capture screenshots automatically of your screen!

TASCA : The Automatic Screenshot Capturing Application An application to capture screenshots automatically of your screen! Report Bug · Request Featur

Piyush Sharma 1 Jan 27, 2022
The awesomebooks project is a simple list, but separated into 3 parts and given a retro feel. The main page is where we can add books, and on another page we can see the list, and remove items. There is also a "contact-us" page.

Awesome Books This is the restructured version of the famous awesome-books project! Here you can find JavaScript broken into modules, using import-exp

Matt Gombos 12 Nov 15, 2022
A lightweight (~850 B) library for easy mac/window shortcut notation. kbd-txt convert shortcut text depending on the type of OS (window/linux/mac).

kbd-txt A lightweight (~850 B) library for easy mac/window shortcut notation. kbd-txt convert shortcut text depending on the type of OS (window/linux/

Minung Han 6 Jan 1, 2023
BookStore is a website that allows a given user to view a list of books, to add a new book and remove a given book.

Project Name : BookStore CMS BookStore is a website that allows a given user to view a list of books, to add a new book and remove a given book. In or

Chris Siku 10 Aug 22, 2022
Given a list of items, only render what's visible on the screen while allowing scrolling the whole list.

Solid Windowed Given a list of items, only render what's visible on the screen while allowing scrolling the whole list. A Solid component. See https:/

Tito 40 Dec 21, 2022
This project is a web app that uses the TVmaze API to retrieve data and display a list of items on the screen.

This project is a web app that uses the TVmaze API to retrieve data and display a list of items on the screen. It also enables people to like and comment on the broadcast. JavaScript, API, Bootstrap, HTML, and CSS3 were used to create this site.

Mihreteab Misganaw 2 Jan 10, 2022