# optimizer-image

> Get optimized image info (URL, width and height) on both the server and the client

Latest version **1.0.5** (published 2014-11-25) · Apache License v2.0 license · 0 weekly downloads

## Install

```sh
npm install optimizer-image
pnpm add optimizer-image
yarn add optimizer-image
bun add optimizer-image
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2014-11-25 |
| First published | 2014-10-06 |
| Weekly downloads | 0 |
| License | Apache License v2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Patrick Steele-Idem |
| Maintainers | pnidem |
| Keywords | optimizer, optimizer-plugin, image |

## Links

- npm: https://www.npmjs.com/package/optimizer-image
- Repository: https://github.com/raptorjs/optimizer-image
- Issues: https://github.com/raptorjs/optimizer-image/issues
- npm.io page: https://npm.io/package/optimizer-image

## Dependencies (2)

- [image-size](https://npm.io/package/image-size.md) ^0.3.3
- [raptor-async](https://npm.io/package/raptor-async.md) ^1.0.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.5 (latest) — 2014-11-25
- 1.0.4 — 2014-10-22
- 1.0.3 — 2014-10-15
- 1.0.2 — 2014-10-08
- 1.0.1 — 2014-10-06
- 1.0.0 — 2014-10-06

## README

optimizer-image
================

This module provides a plugin for the [RaptorJS Optimizer](https://github.com/raptorjs/optimizer) and a JavaScript API
that allows image info (URL, width and height) to be retrieved on both the server and the client.

# Installation

Install the plugin:

```
npm install optimizer-image --save
```

Enable the plugin:

```javascript
require('optimizer').configure({
    plugins: [
        'optimizer-image',
        ...
    ]
})
```

# Usage

The following code can be used to get image info (URL, width and height) on both the server and the client:

```javascript
var optimizerImage = require('optimizer-image');
optimizerImage.getImageInfo(require.resolve('./my-image.png'), function(err, imageInfo) {
    if (err) {
        // Handle the error
    }

    console.log('URL: ', imageInfo.url);
    console.log('width: ', imageInfo.width);
    console.log('height: ', imageInfo.height);
});
```

Referenced images will automatically be optimized and written and the URL for the optimized image will be returned. The
result is cached (on the server) so there is no performance penalty in making subsequent calls for the same image path.

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