{"id":21327023,"url":"https://github.com/coderosh/image-size","last_synced_at":"2025-07-12T07:31:07.167Z","repository":{"id":57103137,"uuid":"421489406","full_name":"coderosh/image-size","owner":"coderosh","description":"Get height and width of image in node and browser","archived":false,"fork":false,"pushed_at":"2022-02-10T02:33:28.000Z","size":94,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T15:47:56.650Z","etag":null,"topics":["image","image-size","isomorphic"],"latest_commit_sha":null,"homepage":"https://coderosh.github.io/image-size/","language":"TypeScript","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/coderosh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-26T15:52:26.000Z","updated_at":"2023-12-19T00:26:26.000Z","dependencies_parsed_at":"2022-08-21T00:30:15.145Z","dependency_job_id":null,"html_url":"https://github.com/coderosh/image-size","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/coderosh/image-size","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderosh%2Fimage-size","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderosh%2Fimage-size/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderosh%2Fimage-size/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderosh%2Fimage-size/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderosh","download_url":"https://codeload.github.com/coderosh/image-size/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderosh%2Fimage-size/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264958135,"owners_count":23689006,"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":["image","image-size","isomorphic"],"created_at":"2024-11-21T21:12:52.788Z","updated_at":"2025-07-12T07:31:06.795Z","avatar_url":"https://github.com/coderosh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# image-size\n\n\u003e Get height and width of image using [Image](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image) api in browser and [buffer-image-size](https://npmjs.com/package/buffer-image-size) package in nodejs.\n\n\u003ca href=\"https://npmjs.com/package/@coderosh/image-size\"\u003e\u003cimg alt=\"NPM\" src=\"https://img.shields.io/npm/v/@coderosh/image-size\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/coderosh/image-size\"\u003e\u003cimg alt=\"MIT\" src=\"https://img.shields.io/badge/license-MIT-blue.svg\" /\u003e\u003c/a\u003e\n\u003ca href=\"#\"\u003e\u003cimg alt=\"CI\" src=\"https://img.shields.io/github/workflow/status/coderosh/image-size/CI\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/coderosh/image-size\"\u003e\u003cimg src=\"https://img.shields.io/badge/PRs-welcome-brightgreen.svg\" alt=\"PRs welcome!\" /\u003e\u003c/a\u003e\n\n## Installation\n\n```sh\n# npm\nnpm install @coderosh/image-size\n\n# yarn\nyarn add @coderosh/image-size\n```\n\n## Usage\n\n- Image source as url (nodejs and browser)\n\n  ```js\n  import imageSize from '@coderosh/image-size'\n\n  const main = async () =\u003e {\n    const url = 'https://ulka.js.org/logo.png'\n\n    const size = await imageSize(url)\n    console.log(size) // { height: 827, width: 738 }\n  }\n  ```\n\n- Image source as arraybuffer (nodejs and browser)\n\n  ```js\n  import imageSize from '@coderosh/image-size'\n\n  const main = async () =\u003e {\n    const url = 'https://ulka.js.org/logo.png'\n    const ab = await fetch(url).then((res) =\u003e res.arrayBuffer())\n\n    const size = await imageSize(ab)\n    console.log(size) // { height: 827, width: 738 }\n  }\n  ```\n\n- Image source as buffer (nodejs only)\n\n  ```js\n  import imageSize from '@coderosh/image-size'\n\n  const main = async () =\u003e {\n    const url = 'https://ulka.js.org/logo.png'\n    const buffer = await fetch(url).then((res) =\u003e res.buffer())\n\n    const size = await imageSize(buffer)\n    console.log(size) // { height: 827, width: 738 }\n  }\n  ```\n\n- Image source as blob (browser only)\n\n  ```js\n  import imageSize from '@coderosh/image-size'\n\n  const main = async () =\u003e {\n    const url = 'https://ulka.js.org/logo.png'\n    const blob = await fetch(url).then((res) =\u003e res.blob())\n\n    const size = await imageSize(blob)\n    console.log(size) // { height: 827, width: 738 }\n  }\n  ```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderosh%2Fimage-size","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderosh%2Fimage-size","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderosh%2Fimage-size/lists"}