{"id":13446849,"url":"https://github.com/gillyb/reimg","last_synced_at":"2025-03-21T16:32:58.012Z","repository":{"id":57352589,"uuid":"41419899","full_name":"gillyb/reimg","owner":"gillyb","description":"reimg - A javascript library for converting image formats","archived":false,"fork":false,"pushed_at":"2019-04-13T20:35:42.000Z","size":12,"stargazers_count":127,"open_issues_count":5,"forks_count":46,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-16T10:35:46.033Z","etag":null,"topics":["canvas","javascript-library","svg"],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/gillyb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-26T10:35:47.000Z","updated_at":"2025-01-10T15:32:06.000Z","dependencies_parsed_at":"2022-09-16T08:11:46.630Z","dependency_job_id":null,"html_url":"https://github.com/gillyb/reimg","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/gillyb%2Freimg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gillyb%2Freimg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gillyb%2Freimg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gillyb%2Freimg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gillyb","download_url":"https://codeload.github.com/gillyb/reimg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244829642,"owners_count":20517349,"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","javascript-library","svg"],"created_at":"2024-07-31T05:01:01.514Z","updated_at":"2025-03-21T16:32:57.737Z","avatar_url":"https://github.com/gillyb.png","language":"HTML","funding_links":[],"categories":["HTML","others"],"sub_categories":[],"readme":"# reimg\nreimg - A javascript library for converting image formats \nThis can convert : \n* svg -\u003e base64\n* svg -\u003e canvas\n* svg -\u003e html `\u003cimg/\u003e` element\n* svg -\u003e png\n* canvas -\u003e base64\n* canvas -\u003e html `\u003cimg/\u003e` element\n* canvas -\u003e png\n\n\nI needed to do this transformations a few times in the past, and got tired of looking them up.  \nMost of the solutions I found were either more complicated, or they required heavy 3rd party libraries or frameworks.   \nThis is a very lightweight solution, and very simple to follow.  \n\u003cbr/\u003e\u003cbr/\u003e\n\nJust include this library in your html code :\n```html\n\u003cscript src=\"reimg.js\"\u003e\u003c/script\u003e\n```\n\u003cbr/\u003e\u003cbr/\u003e\nHere are some examples on how to use it :\n```javascript\n// convert svg element to img element\nvar img = ReImg.fromSvg(document.querySelector('svg')).toImg();\n// now 'img' is the img element created\n\n// convert svg element to png\nvar png = ReImg.fromSvg(document.getElementById('svg-element-id')).toPng();\n\n// force client download of svg as png image\nReImg.fromSvg(document.querySelector('svg')).downloadPng();\n\n// convert canvas to png\nvar png = ReImg.fromCanvas(document.getElementById('canvasId')).toPng();\n```\n\n\u003cbr/\u003e\u003cbr/\u003e\n## License  \nThis piece of software is issued under the MIT license. You can view the license [here](https://github.com/gillyb/reimg/blob/master/LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgillyb%2Freimg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgillyb%2Freimg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgillyb%2Freimg/lists"}