0.3.1 • Published 2 years ago

react-native-image-generator v0.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-native-image-generator

Library for generate images from other images

Installation

yarn add react-native-image-generator

Usage

import { generate } from 'react-native-image-generator';

// ...
const r = await generate(
  [
    {
      uri: 'https://picsum.photos/200/300',
      width: 200,
      height: 300,
      x: 0,
      y: 0,
    },
    {
      uri: 'Mario', // named asset or assets file in android
      width: 200,
      height: 300,
      x: 0,
      y: 0,
    },
    {
      text: 'DESIGN',
      fontSize: 23,
      width: 300,
      height: 300,
      x: 50,
      y: 50,
      color: [0, 255, 0, 1.0],
      fontFamily: Platform.OS === 'ios' ? 'Helvetica' : 'Roboto',
    },
  ],
  {
    filename: 'test.png',
    width: 200,
    height: 300,
  }
);

Result

Hot to use assets

To use local image you need to put it in assets

iOS

In iOS you need to put it Images:

Android

Make sure that your file placed here android/app/src/main/assets/. For example: android/app/src/main/assets/Mario

Platforms

  • iOS
  • Android

License

MIT