Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fthuin/nativescript-image-black-and-white

NativeScript plugin to turn images into black-and-white images
https://github.com/fthuin/nativescript-image-black-and-white

filter images nativescript typescript

Last synced: 20 days ago
JSON representation

NativeScript plugin to turn images into black-and-white images

Awesome Lists containing this project

README

        

# nativescript-image-black-and-white

This plugin allows you to put an image in black and white (also called gray scale filter). It is using native iOS and Android features, so it is very nice in terms of performance and **it does not contain any third-party library** so it is very small.

Original | Modified
:-------------------------:|:-------------------------:
ios-before | ios-after

Original | Modified
:-------------------------:|:-------------------------:
android-before | android-after

## Installation

```bash
tns plugin add nativescript-image-black-and-white
```

## Usage

```typescript
import { Image } from 'tns-core-modules/ui/image';
import { ImageBlackAndWhite } from 'nativescript-image-black-and-white';

const image: Image = ...; // Initialize or get your image
const imageBlackAndWhite = new ImageBlackAndWhite();
imageBlackAndWhite.blackAndWhite(image);
```

Do not hesitate to look at the demo for a working example (screenshots come from there).

## API

This library is very simple, you create a new instance of `ImageBlackAndWhite`, you call the only method which is `blackAndWhite` with a Nativescript Image as parameter.

```
class ImageBlackAndWhite {
blackAndWhite(img: Image): void;
}
```

## Thanks

Thanks to NativeScript team for the the plugin-seed and demo app template.

Thanks to Brad Martin for its implementation of [nativescript-image-filters](https://github.com/bradmartin/nativescript-image-filters).

## License

Most of the code comes from NativeScript team (plugin-seed and demo app) :
Apache License Version 2.0, January 2004

iOS implementation comes from [nativescript-image-filters](https://github.com/bradmartin/nativescript-image-filters) released by Brad Martin under MIT License.

My implementation for Android is under WTFPL.