{"id":16548700,"url":"https://github.com/lizheming/simple2canvas","last_synced_at":"2025-03-21T10:31:54.984Z","repository":{"id":55002152,"uuid":"242447743","full_name":"lizheming/Simple2Canvas","owner":"lizheming","description":"Generate image with json data by canvas","archived":false,"fork":false,"pushed_at":"2022-09-10T22:58:07.000Z","size":2471,"stargazers_count":26,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T03:34:46.371Z","etag":null,"topics":["canvas","generator","html2canvas","image","json","simple2canvas"],"latest_commit_sha":null,"homepage":"https://simple2canvas.netlify.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lizheming.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-23T03:09:15.000Z","updated_at":"2025-01-10T11:36:59.000Z","dependencies_parsed_at":"2022-08-14T08:40:54.659Z","dependency_job_id":null,"html_url":"https://github.com/lizheming/Simple2Canvas","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/lizheming%2FSimple2Canvas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lizheming%2FSimple2Canvas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lizheming%2FSimple2Canvas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lizheming%2FSimple2Canvas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lizheming","download_url":"https://codeload.github.com/lizheming/Simple2Canvas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244777940,"owners_count":20508818,"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":["canvas","generator","html2canvas","image","json","simple2canvas"],"created_at":"2024-10-11T19:26:45.682Z","updated_at":"2025-03-21T10:31:54.528Z","avatar_url":"https://github.com/lizheming.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple2Canvas\nGenerate image with json data by canvas https://simple2canvas.netlify.com/\n\n## Installation\n\nYou can install it with npm or `\u003cscript\u003e`:\n\n```bash\nnpm install simple2canvas --save-dev\n```\n\n```html\n\u003cscript src=\"https://unpkg/simple2canvas/dist/simplecanvas.umd.min.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\n```js\nconst simple2canvas = require('simple2canvas');\nconst options = {\n  width: 360,\n  height: 360,\n  rate: 2,\n  elements: [\n    {\n      type: 'rect',\n      width: 360,\n      height: 360,\n      top: 0,\n      left: 0,\n      fill: '#FFF'\n    },\n    {\n      type: 'text',\n      text: 'Hello World!',\n      top: 10, \n      left: 10,\n      fontSize: 18,\n      lineHeight: 18,\n      color: 'black'\n    }\n  ]\n};\n\n(async() =\u003e {\n  const canvas = await simple2canvas(options);\n  \n  const img = document.createElement('img');\n  img.style.width = options.width + 'px';\n  img.style.height = options.height + 'px';\n  img.src = canvas.toDataURL();\n  document.body.appendChild(img);\n})();\n```\n\n## Configuration\n\n| name | required | default | description |\n|------|:----------:|:---------:|-------------|\n| width | ✔️ | | canvas width |\n| height | ✔️ | | canvas height |\n| rate | | 1 | canvas pixel ratio |\n| render | | 'html' | canvas render |\n| elements | | [] | canvas elements |\n\n### Elements Configuration\n\n#### rect\n\n- `top`\n- `left`\n- `width`\n- `height`\n- `fill`\n- `round`\n\n#### image\n\n- `top`\n- `left`\n- `width`\n- `height`\n- `url`\n\n#### text\n\n- `top`\n- `left`\n- `fontSize`\n- `lineHeight`\n- `text`\n- `color`\n- `textAlign`\n- `fontWeight`\n- `fontFamily`\n\n## Example\nrun npm start and open http://localhost:3000\n\nonline example: https://simple2canvas.netlify.com/\n\n## License\nsimple2canvas is released under the MIT license.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flizheming%2Fsimple2canvas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flizheming%2Fsimple2canvas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flizheming%2Fsimple2canvas/lists"}