Skip to content

About

Chrome screenshot extension built on native capture APIs: visible area, region, and full page, straight to the clipboard.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Screengrab

A small Chrome extension for screenshots that uses only Chrome's built-in capture APIs.

  • Three modes: visible area, a region you drag out, or the full height of the page.
  • Paste or save: every capture goes to the clipboard right away, and a toast offers Save as PNG.
  • Nothing extra: no libraries, no build step, no remote code, no analytics. Images never leave your browser.

Why Native

Most screenshot extensions scroll the page and stitch the pieces together, or re-render the DOM with a library like html2canvas. Both can break on sticky headers, lazy-loaded images, and canvas or video elements. Screengrab asks Chrome itself for the pixels:

Mode Shortcut Chrome API
Visible area Alt+Shift+1 chrome.tabs.captureVisibleTab
Select region Alt+Shift+2 captureVisibleTab, cropped to the box you drag (accounts for high-DPI screens and page zoom)
Full page Alt+Shift+3 DevTools protocol Page.captureScreenshot with captureBeyondViewport, the same path as DevTools' "Capture full size screenshot"

Install

Screengrab isn't on the Chrome Web Store. Load it unpacked:

  1. Clone the repo, or download it as a ZIP and unzip it:

    git clone https://github.com/webteractive/screengrab.git
  2. Open chrome://extensions and turn on Developer mode.

  3. Click Load unpacked and select the screengrab folder.

  4. Pin Screengrab from Chrome's extensions menu.

To update, git pull and click the reload icon on Screengrab's card in chrome://extensions.

Usage

Click the toolbar button and pick a mode, or use a shortcut. You can change the shortcuts at chrome://extensions/shortcuts; the popup always shows the current ones.

After each capture, a toast appears in the top-right corner of the page:

  • The image is already on your clipboard, ready to paste into Slack, a ticket, or a doc.
  • Save writes screenshot-YYYY-MM-DD-HHMMSS.png to your Downloads folder.
  • Copy copies it again if the automatic copy couldn't run.
  • The toast closes itself after 8 seconds, and stays open while your mouse is over it.

In region mode, press Esc or right-click to cancel.

Things to Know

  • Full page shows a yellow "started debugging this browser" bar while it runs. That's Chrome's notice for the debugger permission, and it goes away when the capture finishes. Screengrab waits for the bar to finish sliding in before it captures; capturing while the page is still resizing repeats the first screen down the image. Full page also fails while DevTools is open on that tab, because only one debugger can attach at a time.
  • Pages that scroll inside an inner panel (Gmail, Slack, many web apps) capture only the visible area in full-page mode, because the page itself doesn't scroll.
  • Very tall pages (over about 16,000 device pixels) may come out cut off. That's Chrome's GPU texture limit.
  • Restricted pages such as chrome://, the Chrome Web Store, and other extensions' pages can't be captured. The toolbar icon shows a red ! instead, and hovering it shows the reason.
  • Clipboard needs HTTPS and a focused page. If the automatic copy can't run, the toast says so and the Copy button works on click. On plain http:// pages, use Save.

Permissions

Permission Why
activeTab Capture and inject into the current tab, only after you click the toolbar button or press a shortcut. There's no access to other tabs or sites.
scripting Inject the region picker and the toast into that tab.
debugger Full-page capture through the DevTools protocol.
downloads The Save button.
clipboardWrite Copying the image.

How It's Built

File Role
manifest.json Manifest V3: permissions, popup, shortcuts
background.js Service worker: runs the captures, crops regions, saves downloads
region.js Injected on demand: the drag-to-select overlay
toast.js Injected on demand: preview, clipboard copy, and the Save button
popup.html / .css / .js Toolbar popup with the three modes
icons/icon.svg Icon source

The overlay and toast render inside closed shadow roots with constructed stylesheets and no innerHTML, so page styles, CSP, and Trusted Types don't interfere with them.

To regenerate the icon PNGs after editing the SVG (needs librsvg):

for s in 16 32 48 128; do rsvg-convert -w $s -h $s icons/icon.svg -o icons/icon-$s.png; done

License

MIT. See LICENSE.

About

Chrome screenshot extension built on native capture APIs: visible area, region, and full page, straight to the clipboard.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages