# viewfinder

> A client side image preview and cropper

Latest version **1.0.9** (published 2016-07-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install viewfinder
pnpm add viewfinder
yarn add viewfinder
bun add viewfinder
```

## 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.9 |
| Published | 2016-07-13 |
| First published | 2016-01-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Postmates Engineering |
| Maintainers | drdelambre, samstr |
| Keywords | react, crop, image, upload, preview, wysiwyg |

## Links

- npm: https://www.npmjs.com/package/viewfinder
- Repository: https://github.com/postmates/viewfinder
- Issues: https://github.com/postmates/viewfinder/issues
- npm.io page: https://npm.io/package/viewfinder

## Dependencies (1)

- [velocity-animate](https://npm.io/package/velocity-animate.md) ^1.2.3

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.9 (latest) — 2016-07-13
- 1.0.8 — 2016-07-13
- 1.0.7 — 2016-01-27
- 1.0.6 — 2016-01-27
- 1.0.5 — 2016-01-27
- 1.0.4 — 2016-01-27
- 1.0.3 — 2016-01-27
- 1.0.2 — 2016-01-27
- 1.0.1 — 2016-01-27
- 1.0.0 — 2016-01-27

## README

# viewfinder
Allow users to select an image and crop it inline, removing user confusion when the image is later served and freeing up those precious cycles on the backend

## Demo
![alt text](https://raw.githubusercontent.com/postmates/viewfinder/master/demo.gif "For the visually inclined")

## Usage
```
npm install --save viewfinder
```
```Javascript
import Viewfinder from 'viewfinder';

if (process.env.BROWSER) {
    require('viewfinder/dist/viewfinder.css');
}

class App extends React.Component {
    save() {
        const a = document.createElement("a");
        a.style.display = 'none';
        document.body.appendChild(a);

        // out takes an optional parameter that scales output image relative
        // to the DOM image
        a.href = this.image.out(4);
        a.download = 'viewfinder-image.png';
        a.click();
    }

    render() {
        return (
            <Viewfinder
                ref={ (c) => this.image = c.image }
                scale={ 0.5 } />
            <Button onClick={ this.save.bind(this) }>
                Save
            </Button>
        );
    }
}

export default App;
```

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