Show HN: Capture, compress, and copy screenshots to clipboard

sauravt1 pts0 comments

GitHub - sauravtom/Screenshot2Clipboard: Native macOS menu-bar screenshot utility that copies compressed screenshots to the clipboard · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

sauravtom

Screenshot2Clipboard

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>1 Commit<br>1 Commit

Screenshot2Clipboard.xcodeproj

Screenshot2Clipboard.xcodeproj

Screenshot2Clipboard

Screenshot2Clipboard

.gitignore

.gitignore

LICENSE

LICENSE

README.md

README.md

View all files

Repository files navigation

Screenshot2Clipboard

Screenshot2Clipboard is a native macOS menu-bar utility for capturing screenshots directly to the clipboard. It is designed for fast sharing into chat apps, docs, and AI assistants, with optional JPEG compression so screenshots are smaller before you paste them.

The app has no Dock icon. It lives in the menu bar, registers global shortcuts, and uses macOS's native screenshot selector for region captures.

Features

Menu-bar-only macOS app built with Swift and SwiftUI.

Full-screen screenshot to clipboard.

Selected-area screenshot to clipboard using the native macOS crosshair selector.

Configurable global shortcuts using Carbon hot keys.

Default shortcuts:

Full screen: Control + Option + Command + 3

Selected area: Control + Option + Command + 4

Shortcut hints shown next to the capture menu items.

JPEG compression presets:

Lowest

Low

Medium

High

Last capture metrics in the menu:

megapixels

pixel dimensions

compressed clipboard image size

Launch-at-login toggle.

Screen Recording permission shortcut.

Requirements

macOS 13.0 or later

Xcode with Swift 6 support

How It Works

Screenshot2Clipboard uses macOS's built-in /usr/sbin/screencapture command:

Full screen capture is written to a temporary PNG.

Selected-area capture uses macOS's native interactive selector and writes to a temporary PNG.

The app decodes the PNG with ImageIO, optionally downsizes it based on the selected quality preset, encodes it as JPEG, and writes the JPEG data to the system pasteboard.

The temporary PNG is deleted after processing.

This keeps the capture behavior native while giving the user control over how large the pasted image will be.

Permissions

macOS requires Screen Recording permission for screenshot capture.

If capture fails because permission is missing:

Open the menu-bar app.

Choose Check Permissions.

Enable Screen Recording for Screenshot2Clipboard in System Settings.

Relaunch the app if macOS asks you to.

Global shortcuts are implemented with Carbon RegisterEventHotKey, so they do not require Accessibility permission.

Build Locally

Clone the repository:

git clone https://github.com/sauravtom/Screenshot2Clipboard.git<br>cd Screenshot2Clipboard

Build a Debug app:

xcodebuild \<br>-project Screenshot2Clipboard.xcodeproj \<br>-scheme Screenshot2Clipboard \<br>-configuration Debug \<br>-derivedDataPath build/DerivedData \<br>build

Run the Debug app:

open build/DerivedData/Build/Products/Debug/Screenshot2Clipboard.app

Build a Release app:

xcodebuild \<br>-project Screenshot2Clipboard.xcodeproj \<br>-scheme Screenshot2Clipboard \<br>-configuration Release \<br>-derivedDataPath build/DerivedData \<br>build

Run the Release app:

open build/DerivedData/Build/Products/Release/Screenshot2Clipboard.app

Install the Release app into /Applications:

ditto build/DerivedData/Build/Products/Release/Screenshot2Clipboard.app /Applications/Screenshot2Clipboard.app<br>open /Applications/Screenshot2Clipboard.app

Development

Open the project in Xcode:

open Screenshot2Clipboard.xcodeproj

Main files:

Screenshot2Clipboard/Screenshot2ClipboardApp.swift - menu-bar UI and app entry point.

Screenshot2Clipboard/AppState.swift - application state, shortcut persistence, capture actions, and status messages.

Screenshot2Clipboard/CaptureService.swift - screenshot execution, image compression, and clipboard writing.

Screenshot2Clipboard/HotKeyManager.swift - global shortcut...

screenshot2clipboard build macos capture menu clipboard

Related Articles