# ng6-pica

> Angular 6 fixed for wrapper for pica to resize images.

Latest version **0.0.2** (published 2018-06-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install ng6-pica
pnpm add ng6-pica
yarn add ng6-pica
bun add ng6-pica
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2018-06-03 |
| First published | 2018-06-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 99.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kris Chen |
| Maintainers | kristophor |
| Keywords | angular, angular2, pica, image, resize |

## Links

- npm: https://www.npmjs.com/package/ng6-pica
- Repository: https://github.com/kristophor/ng2-pica
- Homepage: https://github.com/kristophor/ng2-pica/blob/master/README.md
- Issues: https://github.com/kristophor/ng2-pica/pulls
- npm.io page: https://npm.io/package/ng6-pica

## Dependencies (2)

- [pica](https://npm.io/package/pica.md) >=4.0.1
- [exif-js](https://npm.io/package/exif-js.md) ^2.3.0

## 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

- 0.0.2 (latest) — 2018-06-03

## README

# ng2-pica

Rxjs 6 and angular update for [https://github.com/bergben/ng2-pica](https://github.com/bergben/ng2-pica)\

All development credit goes to: [bergben](https://www.npmjs.com/~bergben)

Angular wrapper for <a href="https://github.com/nodeca/pica">pica</a> to resize images. 

## Install Angular 6 & rxjs 6 temporarily fix

```bash
$ npm install ng6-pica --save
```

## Install Angular 5 please see orignal author
[https://www.npmjs.com/package/ng2-pica](https://www.npmjs.com/package/ng2-pica)
```bash
$ npm install ng2-pica --save
```

### Import the module
```TypeScript
// app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { Ng6PicaModule } from 'ng2-pica'; // <-- import the module
import { MyComponent } from './my.component';

@NgModule({
    imports: [BrowserModule,
              Ng6PicaModule // <-- include it in your app module
             ],
    declarations: [MyComponent],  
    bootstrap: [MyComponent]
})
export class MyAppModule {}
```
## Usage
```TypeScript
import { Ng6PicaService } from 'ng6-pica';

@Injectable()
export class ImgMaxPXSizeService {
    constructor(private ng2PicaService: Ng6PicaService) {
      this.ng2PicaService.resize([someFile], newWidth, newHeight).subscribe((result)=>{
            //all good, result is a file
            console.info(result);
      }, error =>{
            //something went wrong 
            console.error(error);
      });
    }
}
```

## Methods
 All Document refers back to original Author: 
 [https://www.npmjs.com/package/ng2-pica](https://www.npmjs.com/package/ng2-pica)
### `.resize(files: File[], width: number, height: number, keepAspectRatio: boolean = false): Observable<any>`
### `resizeCanvas(from: HTMLCanvasElement, to: HTMLCanvasElement, options: resizeCanvasOptions): Promise<HTMLCanvasElement>`
### `resizeBuffer(options: resizeBufferOptions): Promise<Uint8Array>`

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