react-native-image-generator
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

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

Package Sidebar

Install

npm i react-native-image-generator

Weekly Downloads

85

Version

0.3.1

License

MIT

Unpacked Size

38.1 kB

Total Files

28

Last publish

Collaborators

  • evgenusov96