{"id":19448212,"url":"https://github.com/csbun/resize-image","last_synced_at":"2025-04-25T02:30:54.082Z","repository":{"id":35231928,"uuid":"39491299","full_name":"csbun/resize-image","owner":"csbun","description":"Resize images in browser using canvas","archived":false,"fork":false,"pushed_at":"2022-12-07T17:32:51.000Z","size":1529,"stargazers_count":28,"open_issues_count":7,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T22:03:45.581Z","etag":null,"topics":["canvas","image","resize"],"latest_commit_sha":null,"homepage":null,"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/csbun.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":"2015-07-22T07:11:18.000Z","updated_at":"2024-01-23T12:30:50.000Z","dependencies_parsed_at":"2022-08-25T01:31:19.435Z","dependency_job_id":null,"html_url":"https://github.com/csbun/resize-image","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csbun%2Fresize-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csbun%2Fresize-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csbun%2Fresize-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csbun%2Fresize-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csbun","download_url":"https://codeload.github.com/csbun/resize-image/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250741892,"owners_count":21479688,"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","resize"],"created_at":"2024-11-10T16:25:00.136Z","updated_at":"2025-04-25T02:30:53.755Z","avatar_url":"https://github.com/csbun.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# resize-image\n\nResize images in browser using canvas\n\n[![NPM](https://nodei.co/npm/resize-image.png)](https://nodei.co/npm/resize-image/)\n\n[![Build Status](https://travis-ci.org/csbun/resize-image.svg)](https://travis-ci.org/csbun/resize-image)\n[![Coverage Status](https://coveralls.io/repos/csbun/resize-image/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/csbun/resize-image?branch=master)\n\n## Install\n\n### npm\n\n```sh\nnpm i resize-image --save\n```\n\n### bower\n\n```sh\nbower install resize-image --save\n```\n\n## Usage\n\n```javascript\nvar resizeImage = require('resize-image');\n\nvar img = new Image();\nimg.onload= function () {\n  var data = resizeImage.resize(img, 200, 100, resizeImage.PNG);\n  console.log(data);\n};\nimg.src = url; // local image url\n```\n\n### .resize2Canvas(img, width, height)\n\nresize an `\u003cimg\u003e` or `Image` or `\u003ccanvas\u003e` to canvas\n\n- {Image}  img:    an `\u003cimg\u003e` or `Image()`\n- {number} [width]:  output image width\n- {number} [height]: output image height\n\n### .resize(img, width, height, type)\n\nresize an `\u003cimg\u003e` or `Image` or `\u003ccanvas\u003e` to base64\n\n- {Image}  img:    an `\u003cimg\u003e` or `Image()`\n- {number} [width]:  output image width\n- {number} [height]: output image height\n- {string} [type]:   output image type\n\n### types\n\n- .PNG (default)\n- .GIF\n- .BMP\n- .JPEG\n- .WEBP\n\n## Examples\n\n```\nyarn\nnpm run example\n```\n\nAnd visit http://localhost:9000/.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsbun%2Fresize-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsbun%2Fresize-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsbun%2Fresize-image/lists"}