{"id":19337668,"url":"https://github.com/sheetjs/js-wmf","last_synced_at":"2025-07-12T12:03:47.103Z","repository":{"id":57398691,"uuid":"244088912","full_name":"SheetJS/js-wmf","owner":"SheetJS","description":"Windows MetaFile (wmf) processor","archived":false,"fork":false,"pushed_at":"2020-03-16T16:32:15.000Z","size":91,"stargazers_count":18,"open_issues_count":2,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T08:44:31.903Z","etag":null,"topics":["canvas","image","javascript","wmf"],"latest_commit_sha":null,"homepage":"https://oss.sheetjs.com/js-wmf","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SheetJS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"SheetJSDev","custom":"https://sheetjs.com","open_collective":"s5s"}},"created_at":"2020-03-01T04:51:46.000Z","updated_at":"2023-12-05T05:11:21.000Z","dependencies_parsed_at":"2022-09-01T16:04:03.354Z","dependency_job_id":null,"html_url":"https://github.com/SheetJS/js-wmf","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/SheetJS%2Fjs-wmf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SheetJS%2Fjs-wmf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SheetJS%2Fjs-wmf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SheetJS%2Fjs-wmf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SheetJS","download_url":"https://codeload.github.com/SheetJS/js-wmf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250352220,"owners_count":21416458,"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","image","javascript","wmf"],"created_at":"2024-11-10T03:15:05.696Z","updated_at":"2025-04-23T01:31:03.249Z","avatar_url":"https://github.com/SheetJS.png","language":"TypeScript","readme":"# js-wmf\n\nProcessor for Windows MetaFile (WMF) files in JS (for the browser and nodejs).\n\n\n## Installation\n\nWith [npm](https://www.npmjs.org/package/wmf):\n\n```bash\n$ npm install wmf\n```\n\nIn the browser:\n\n```html\n\u003cscript src=\"wmf.js\"\u003e\u003c/script\u003e\n```\n\nThe browser exposes a variable `WMF`.\n\n\n## Usage\n\nThe `data` argument is expected to be an `ArrayBuffer`, `Uint8Array` or `Buffer`\n\n- `WMF.image_size(data)` extracts the image offset and extents, returns an Array\n  `[width, height]` where both metrics are measured in pixels.\n\n- `WMF.draw_canvas(data, canvas)` parses the WMF and draws to a `Canvas`.\n\n### Notes\n\n- The library assumes the global `ImageData` is available.  For nodejs-powered\n  canvas implementations, a shim must be exposed as a global. Using the `canvas`\n  npm package:\n\n```js\nconst { createImageData } = require(\"canvas\");\nglobal.ImageData = createImageData;\n```\n\n- `OffscreenCanvas` in Chrome and some other Canvas implementations require\n  the dimensions in the constructor:\n\n```js\nconst size = WMF.image_size(data);\nconst canvas = new OffscreenCanvas(size[0], size[1]);\n```\n\n\n## Examples\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cb\u003eBrowser Fetch into canvas\u003c/b\u003e (click to show)\u003c/summary\u003e\n\n```js\n// assume `canvas` is a DOM element\n(async() =\u003e {\n  const res = await fetch(\"url/for/image.wmf\");\n  const ab = await res.arrayBuffer();\n  WMF.draw_canvas(ab, document.getElementById(\"canvas\"));\n})();\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cb\u003eNodeJS (using `canvas` npm module)\u003c/b\u003e (click to show)\u003c/summary\u003e\n\n```js\nconst { createCanvas, createImageData } = require(\"canvas\");\nglobal.ImageData = createImageData;\n\nconst size = WMF.image_size(data);\nconst canvas = createCanvas(size[0], size[1]);\nWMF.draw_canvas(data, canvas);\n```\n\n\u003c/details\u003e\n\n\n## License\n\nPlease consult the attached LICENSE file for details.  All rights not explicitly\ngranted by the Apache 2.0 License are reserved by the Original Author.\n\n\n## References\n\n - `MS-WMF`: Windows Metafile Format\n\n","funding_links":["https://github.com/sponsors/SheetJSDev","https://sheetjs.com","https://opencollective.com/s5s"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheetjs%2Fjs-wmf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsheetjs%2Fjs-wmf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheetjs%2Fjs-wmf/lists"}