{"id":22552829,"url":"https://github.com/rosesonfire/magic-erase","last_synced_at":"2026-04-20T13:38:17.963Z","repository":{"id":57153502,"uuid":"111533169","full_name":"rosesonfire/magic-erase","owner":"rosesonfire","description":"Clear blurry background in close-focused images with click points","archived":false,"fork":false,"pushed_at":"2017-12-01T00:38:20.000Z","size":188,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-25T01:22:39.472Z","etag":null,"topics":["blurred-background","close-focused","image-editting","image-processing","magic-wand","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rosesonfire.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-21T10:20:05.000Z","updated_at":"2020-12-21T14:32:20.000Z","dependencies_parsed_at":"2022-09-07T06:12:13.415Z","dependency_job_id":null,"html_url":"https://github.com/rosesonfire/magic-erase","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosesonfire%2Fmagic-erase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosesonfire%2Fmagic-erase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosesonfire%2Fmagic-erase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosesonfire%2Fmagic-erase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rosesonfire","download_url":"https://codeload.github.com/rosesonfire/magic-erase/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246010045,"owners_count":20709053,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blurred-background","close-focused","image-editting","image-processing","magic-wand","nodejs"],"created_at":"2024-12-07T18:07:41.060Z","updated_at":"2025-10-19T17:03:08.161Z","avatar_url":"https://github.com/rosesonfire.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm][npm-image]][npm-url]  [![javascript style guide][standard-image]][standard-url]\n\n\n[npm-image]: https://img.shields.io/npm/v/npm.svg\n[npm-url]: https://www.npmjs.com/package/magic-erase\n[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg\n[standard-url]: https://standardjs.com\n\nClear blurry background in close-focused images, by selecting click-points on the image. Works like the magic-wand tool in Photoshopp.\n# Installation\n`npm install magic-erase`\n# Usage\n```\nvar magicErase = require('magic-erase')\n```\n## Configuration\n```\n// Tweak the Sensitivity for optimal result\n\nvar config = {\n  image: 'path-to-image', // JPG format and preferrably less than 100 kB\n  sensitivity: 50, // ranges from 0.1 to 100,\n  erasePoints: [\n     // a list of points on the image which will be used as the click points\n     // each point is \u003cx-coordinate, y-coordinate\u003e\n     // x-coordinate is from left to right\n     // y-coordinate is from top to bottom\n     // coordinates are normalized within the range 0 to 100 (i.e. percentage)\n    [45, 86], [87, 12], [9, 56]\n  ]\n}\n```\n## API\n```\nvar fs = require('fs')\n\nvar firstPass = magicErase(config).then(function (response) {\n  // save erased result as image file ...\n  var base64Img = response.base64Img\n  fs.writeFile('output-image.jpg', base64Img, { encoding: 'base64' }, function() {\n  \tconsole.log('Saved output image')\n  })\n  // use the erased result data for a second erase pass\n  var data = response.data\n  return data\n})\n```\n```\nvar secondPass = firstPass.then(function(response) {\n  var newConfig = {\n    image: response,\n    sensitivity: 48,\n    erasePoints: [[8, 4], [65, 12]]\n  }\n  return magicErase(newConfig)\n}).then(function(response) {\n  // just like in the first pass\n  var base64Img = response.base64Img\n  // use base64Img ...\n  return response.data\n})\n\n// .. do as many passes as you like ...\n\n```\n# Caution\n- Bigger images will take longer time\n# Web console\n[magic-erase-console](https://github.com/rosesonfire/magic-erase-console) is a simple web console for the magic-erase package.\n# Examples\nName|Image|AfterErasing|Sensitivity\n-|-|-|-\nBaseball|\u003cimg src=\"./examples/app/baseball.jpg\" width=\"200\" /\u003e|\u003cimg src=\"./examples/app/objects/baseball.jpg\" width=\"200\"\u003e|12.2\nBirb|\u003cimg src=\"./examples/app/birb.jpg\" width=\"200\" /\u003e|\u003cimg src=\"./examples/app/objects/birb.jpg\" width=\"200\"\u003e|77.9\nCherry|\u003cimg src=\"./examples/app/cherry.jpg\" width=\"200\" /\u003e|\u003cimg src=\"./examples/app/objects/cherry.jpg\" width=\"200\"\u003e|55\nMic|\u003cimg src=\"./examples/app/mic.jpg\" width=\"200\" /\u003e|\u003cimg src=\"./examples/app/objects/mic.jpg\" width=\"200\"\u003e|14.9\nSunflower|\u003cimg src=\"./examples/app/sunflower.jpg\" width=\"200\" /\u003e|\u003cimg src=\"./examples/app/objects/sunflower.jpg\" width=\"200\"\u003e|67.3\nFlower|\u003cimg src=\"./examples/app/flower.jpg\" width=\"200\" /\u003e|\u003cimg src=\"./examples/app/objects/flower.jpg\" width=\"200\"\u003e|0.1","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosesonfire%2Fmagic-erase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frosesonfire%2Fmagic-erase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosesonfire%2Fmagic-erase/lists"}