{"id":23666568,"url":"https://github.com/redsift/rollup-plugin-imagedata","last_synced_at":"2025-12-11T05:30:14.505Z","repository":{"id":65599424,"uuid":"65035607","full_name":"redsift/rollup-plugin-imagedata","owner":"redsift","description":"Import image data and metadata into a rollup JavaScript bundle","archived":false,"fork":false,"pushed_at":"2016-08-09T16:47:34.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-02-11T09:47:23.940Z","etag":null,"topics":[],"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/redsift.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":"2016-08-05T17:06:24.000Z","updated_at":"2016-11-12T20:13:17.000Z","dependencies_parsed_at":"2023-01-31T06:45:15.452Z","dependency_job_id":null,"html_url":"https://github.com/redsift/rollup-plugin-imagedata","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/redsift%2Frollup-plugin-imagedata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redsift%2Frollup-plugin-imagedata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redsift%2Frollup-plugin-imagedata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redsift%2Frollup-plugin-imagedata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redsift","download_url":"https://codeload.github.com/redsift/rollup-plugin-imagedata/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239674871,"owners_count":19678487,"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":[],"created_at":"2024-12-29T07:33:09.539Z","updated_at":"2025-12-11T05:30:14.446Z","avatar_url":"https://github.com/redsift.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rollup-plugin-imagedata\n\n[![Circle CI](https://img.shields.io/circleci/project/redsift/rollup-plugin-imagedata.svg?style=flat-square)](https://circleci.com/gh/redsift/rollup-plugin-imagedata)\n[![npm](https://img.shields.io/npm/v/@redsift/rollup-plugin-imagedata.svg?style=flat-square)](https://www.npmjs.com/package/@redsift/rollup-plugin-imagedata)\n[![MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/redsift/rollup-plugin-imagedata/master/LICENSE)\n\nImport metadata and base64 encoded image content from JPG, PNG, GIF, WEBP and SVG.\n\n## Installation\n\n```bash\n$ npm install --save-dev \"@redsift/rollup-plugin-imagedata\"\n```\n\n## Building via ES6 modules\n\n```js\n// rollup.config.js\nimport image from '@redsift/rollup-plugin-imagedata';\n\nexport default {\n  entry: './index.js',\n  dest: 'distribution/my-lib.js',\n  plugins: [\n    image()\n  ]\n};\n```\n\n## Building via require()\n\n```js\n// gulpfile.js\nvar imagedata = require('@redsift/rollup-plugin-imagedata')\ngulp.task('task', () =\u003e {  \n  return rollup({\n            ...\n            plugins: [ \n                        imagedata.image(),\n                        ...\n                      ]\n        })\n        .pipe(source('index.js', 'src'))\n```\n\n## Usage\n\n```js\n// use.js\nimport { width, height, base64 } from './tests/test.png';\n\nconsole.log(`My image is ${width} pixels wide`);\n...\n\n```\n\nNote that base64 makes the images 33% larger than the size on disk.\n\nTree shaking via rollup will ensure large payloads such as the base64 string will be stripped from the bundle if not imported or used by your code.\n\n## Options\n\nYou may pass a few options to image().\n\n```js\n  image({\n    include: [ ... ], // files to include\n    exclude:[ ... ], // files to exclude\n    patch: false,   // attempt to fix up non compliant assets e.g. SVG files with no XML headers\n    ignoreParsingErrors: true   // Warn but do not fail if files cannot be parsed as images. \n                                // In this case metadata will be missing\n  });\n```\n\n## ImageMagick\n\nThis plugin relies on having ImageMagick installed and in the path as this tool is used to extract metadata from the images. If you wish to use WebP, ensure your binary has support for the format. You can verify your binary by inspecting the built in delegates.\n\n```bash\n$ convert -version\nVersion: ImageMagick 6.9.3-7 Q16 x86_64 2016-04-13 http://www.imagemagick.org\nCopyright: Copyright (C) 1999-2016 ImageMagick Studio LLC\nLicense: http://www.imagemagick.org/script/license.php\nFeatures: Cipher DPC HDRI Modules\nDelegates (built-in): bzlib freetype jng jp2 jpeg lcms ltdl lzma png tiff webp xml zlib\n```\n\nTested on OS-X with `ImageMagick-6.9.3-7`\n\n### OS-X \u0026 Homebrew\n\nTo reinstall imagemagick with WebP support `brew reinstall imagemagick --with-webp`\n\n## Acknowledgements\n\nThis plugin is derived from [rollup-plugin-image](https://github.com/rollup/rollup-plugin-image).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredsift%2Frollup-plugin-imagedata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredsift%2Frollup-plugin-imagedata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredsift%2Frollup-plugin-imagedata/lists"}