# rollup-plugin-image

> Import JPG, PNG, GIF and SVG images

Latest version **1.0.2** (published 2016-06-23) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install rollup-plugin-image
pnpm add rollup-plugin-image
yarn add rollup-plugin-image
bun add rollup-plugin-image
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2016-06-23 |
| First published | 2016-06-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 41 |
| Author | Rich Harris |
| Maintainers | rich_harris |
| Keywords | rollup, modules, images |

## Links

- npm: https://www.npmjs.com/package/rollup-plugin-image
- Repository: https://github.com/rollup/rollup-plugin-image
- Homepage: https://github.com/rollup/rollup-plugin-image#readme
- Issues: https://github.com/rollup/rollup-plugin-image/issues
- npm.io page: https://npm.io/package/rollup-plugin-image

## Dependencies (1)

- [rollup-pluginutils](https://npm.io/package/rollup-pluginutils.md) ^1.3.1

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2016-06-23
- 1.0.1 — 2016-06-06
- 1.0.0 — 2016-06-04

## README

# Moved

This module has moved and is now available at [@rollup/plugin-image](https://github.com/rollup/plugins). Please update your dependencies. This repository is no longer maintained.

# rollup-plugin-image

Import JPG, PNG, GIF and SVG files.

## Installation

```bash
npm install --save-dev rollup-plugin-image
```


## Usage

```js
// rollup.config.js
import image from 'rollup-plugin-image';

export default {
  entry: 'src/index.js',
  dest: 'dist/my-lib.js',
  plugins: [
    image()
  ]
};
```

You can now use images in your bundle like so:

```js
import logo from './rollup.png';
document.body.appendChild( logo );
```

Images are encoded using base64, which means they will be 33% larger than the size on disk. You should therefore only use this for small images where the convenience of having them available on startup (e.g. rendering immediately to a canvas without co-ordinating asynchronous loading of several images) outweighs the cost.


## License

MIT

---
_Source: https://npm.io/package/rollup-plugin-image · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
