Lately, I was looking for a tool to simplify some of my image manipulation tasks, and I came across this little gem that caught my eye.
Magic Copy! It’s a Chrome extension that uses Meta’s ‘Segment Anything’ template to extract an object or person in the foreground of a photo and then copy it directly to the clipboard.
Magical, as the name suggests, right? And that’s not all, as this extension is also available as a Figma plugin.
To install Magic Copy on Chrome, simply download the ZIP file from the versions published on GitHub. Once the extension is installed and activated, you can then use it on any image.
For Docker enthusiasts, a Dockerfile is also provided to “compile” (a misnomer, I know…) the .crx file for Chrome.
The file server-example on the git repository also contains a simple example of how to host the service yourself. Magic Copy (and its demo) offers an endpoint that accepts a POST with an image file and returns a JSON array with the result as a base64 encoded string.
You may be wondering how to set this up on your server, so here’s a quick step-by-step guide:
With Docker already installed, run the following commands:
docker build -t segment-anything .
docker run --gpus all -p 8000:8000 segment-anything
These two commands are sufficient to create a container and launch it. The container will expose port 8000, and in the Chrome Magic Copy extension, you can then change the endpoint to http://localhost:8000/.
In conclusion, Magic Copy makes the process of extracting objects in images as smooth and simple as possible, all without leaving your browser. Plus, it respects your privacy if you choose to host it yourself.