kevmo314/magic-copy
kevmo314/magic-copy has 2,452 GitHub stars and 152 forks. GitHot measured 0 stars in 24 hours and -1 in 7 days. Last checked 2026-11-05 14:58 UTC. Last push 2024-05-06.
Magic Copy is a Chrome extension that uses Meta's Segment Anything Model to extract a foreground object from an image and copy it to the clipboard.
Measured star growth
- in 24h
- 0
- in 7 days
- -1
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalMagic Copy
Magic Copy is a Chrome extension that uses Meta's Segment Anything Model to extract a foreground object from an image and copy it to the clipboard.
https://user-images.githubusercontent.com/511342/234897336-f2441e00-06e0-4ca8-9b97-601210879cdb.mp4
Installation
(This might not be available yet, as the extension is still in review. If you would like to be notified when they do, subscribe to the Chrome or Firefox issues.)
Alternatively, the extension can be installed manually:
- Download the latest
magic-copy.zipfrom releases. - Extract the ZIP file.
- In Chrome, go to
chrome://extensions/, enable "Developer mode", and click "Load unpacked". - Select the folder where the extension was extracted.
Figma
Magic Copy is also available as a Figma plugin.
Implementation
This extension uses the same procedure as the Segment Anything Model demo to extract a foreground object from an image. The only difference is that the extracted object is copied to the clipboard instead of being displayed on the page.
Building
Manually
Build the extension with npm and then run the included ./buildcrx.sh script to generate the crx file:
npm ci
npm run build
./buildcrx.sh -d dist
Docker
A Dockerfile is provided to cleanly build the crx file. To build the extension, run:
docker build --output out .
Self-hosting
The Meta Segment Anything Model requires running the vision transformer on a server to generate the image's embeddings. Magic Copy uses the same service that their demo uses, however some people may not want to send their images to a third party.
The server-example directory contains a simple example of how to self-host the
vision transformer service. It is not meant to be used in production, but rather as
a proof of concept to document the input/output format of the service.
In particular, Magic Copy (and the SAM demo) expect a POST endpoint that accepts
an image file and returns a JSON array of length 1 with the embedding of shape
(1, 256, 64, 64) as a base64 encoded string. See the code for specific details on how
to perform this encoding to be compatible with the demo.
If you are looking to quickly get the service running, you can use the provided
Dockerfile to build a container and run it. The container will expose port 8000
and will serve the service at the / endpoint.
docker build -t segment-anything .
docker run --gpus all -p 8000:8000 segment-anything
In the Magic Copy chrome extension, you can then change the endpoint to http://localhost:8000/.
Explore related projects
codecrafters-io/build-your-own-x
Master programming by recreating your favorite technologies from scratch.
560,279 starspublic-apis/public-apis
A collective list of free APIs
496,541 starsmorluto/rea
Reverse engineer anything with agents, from app behavior down to native binaries.
436,052 starsopenclaw/openclaw
The AI that really does things. Any OS. Any Platform. The lobster way. 🦞
394,028 stars
