# @f/crop-image

> Crop an image using the browser&#x27;s canvas element

Latest version **1.0.0** (published 2016-05-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @f/crop-image
pnpm add @f/crop-image
yarn add @f/crop-image
bun add @f/crop-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.0 |
| Published | 2016-05-26 |
| First published | 2016-05-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | f |

## Links

- npm: https://www.npmjs.com/package/@f/crop-image
- Repository: https://github.com/micro-js/crop-image
- Homepage: https://github.com/micro-js/crop-image#readme
- Issues: https://github.com/micro-js/crop-image/issues
- npm.io page: https://npm.io/package/@f/crop-image

## Dependencies (2)

- [@f/img-to-canvas](https://npm.io/package/@f/img-to-canvas.md) ^1.0.0
- [@f/dataurl-to-blob](https://npm.io/package/@f/dataurl-to-blob.md) ^1.0.0

## Recent versions

- 1.0.0 (latest) — 2016-05-26

## README

# crop-image

[![Build status][travis-image]][travis-url]
[![Git tag][git-image]][git-url]
[![NPM version][npm-image]][npm-url]
[![Code style][standard-image]][standard-url]

Crop an image using the browser&#x27;s canvas element

## Installation

    $ npm install @f/crop-image

## Usage

```js
var cropImage = require('@f/crop-image')

function cropAndUpload (img, x, y, width, height) {
  const blob = cropImage(img, x, y, width, height)
  return upload(blob)
}

```

## API

### cropImage(arg)

  * `img` an `<img>` element
  * `x` the distance along the x axis to begin cropping
  * `y` the distance along the y axis to begin cropping
  * `width` the width of the section you want to crop
  * `height` the height of the section you want to crop
  * `scaleWidth` scale the final image up/down to this width (optional - defaults to `width`)
  * `scaleHeight` scale the final image up/down to this height (optional - defaults to `height`)

**Returns:** A blob containing the cropped image data

## License

MIT

[travis-image]: https://img.shields.io/travis/micro-js/crop-image.svg?style=flat-square
[travis-url]: https://travis-ci.org/micro-js/crop-image
[git-image]: https://img.shields.io/github/tag/micro-js/crop-image.svg?style=flat-square
[git-url]: https://github.com/micro-js/crop-image
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: https://github.com/feross/standard
[npm-image]: https://img.shields.io/npm/v/@f/crop-image.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@f/crop-image

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