# fix-orientation-capacitor

> fixes the Ionic Capacitor's Camera Plugin's output image orientation

Latest version **0.1.1** (published 2019-08-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install fix-orientation-capacitor
pnpm add fix-orientation-capacitor
yarn add fix-orientation-capacitor
bun add fix-orientation-capacitor
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2019-08-28 |
| First published | 2019-01-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 5.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Calvin Ho |
| Maintainers | calvinckho |
| Keywords | capacitor, camera, orientation, correct, portrait, fix |

## Links

- npm: https://www.npmjs.com/package/fix-orientation-capacitor
- npm.io page: https://npm.io/package/fix-orientation-capacitor

## Dependencies (4)

- [png-size](https://npm.io/package/png-size.md) ~0.1.0
- [jpeg-size](https://npm.io/package/jpeg-size.md) 0.0.1
- [data-uri-to-u8](https://npm.io/package/data-uri-to-u8.md) ~1.0.0
- [rotate-component](https://npm.io/package/rotate-component.md) ~1.0.0

## Recent versions

- 0.1.1 (latest) — 2019-08-28
- 0.1.0 — 2019-08-28
- 0.0.6 — 2019-01-08
- 0.0.5 — 2019-01-08
- 0.0.4 — 2019-01-08
- 0.0.3 — 2019-01-08
- 0.0.2 — 2019-01-08
- 0.0.1 — 2019-01-08

## README

# fix-orientation-capacitor

Rotate images generated by Ionic Capacitor Camera Plugin

** This package is intended for an Ionic Capacitor app only. For correcting orientation of general images, consult fix-orientation **

Ionic Capacitor's Camera Plugin has a correctOrientation attribute that does not work in all Android devices.
This package fixes that issue. This code is based on juliangruber's fix-orientation and works with @capacitor/core": 1.1.1.

## Upgrade

Note that with Capacitor version 1.1.1, resultType is changed from CameraResultType.Base64 to CameraResultType.DataUrl

## Usage

```bash
import { CameraResultType, CameraSource, Plugins } from "@capacitor/core";
import fixOrientation from 'fix-orientation-capacitor';

const { Camera } = Plugins;
// notice the attribute 'correctOrientation' must be set to false
const image = await Camera.getPhoto({
                quality: 60,
                width: 1280,
                allowEditing: false,
                resultType: CameraResultType.DataUrl, // please note with the 1.1.1 upgrade, this is no longer using Base64
                source: CameraSource.Prompt,
                correctOrientation: false });

const fixed = await fixOrientation(image);
```

## Installation

With [npm](https://npmjs.org) do:

```bash
npm install fix-orientation-capacitor
```

## License

(MIT)

Copyright (c) 2019 Calvin Ho

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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