GithubHelp home page GithubHelp logo

chriteixeira / react-native-add-qrcode Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 8.95 MB

Add a QR code to an Image in React Native

License: MIT License

Kotlin 18.88% JavaScript 1.08% Objective-C 52.89% Ruby 8.07% TypeScript 19.08%

react-native-add-qrcode's Introduction

react-native-add-qrcode

Add a QRCode to a image.

This libs just supports JPEG images at this moment. We might add other types support if necessary.

Installation

npm install react-native-add-qrcode

Usage

import { addQRCodeToImage } from 'react-native-add-qrcode';

// ...

const result = await addQRCodeToImage('path/to/image', 
                                      'path/to/result/image',
                                      'QR Code Data',
                                      {
                                        x: 10, 
                                        y: 10, 
                                        height: 250,
                                        width: 250,
                                        foregroundColor: '#FFFFFF',
                                        backgroundColor: '#000000'
                                      }
                                    );

API

Signature:

static addQRCodeToImage(imagePath: string, destinationPath: string, data: string, options?: OptionsType): Promise<ResultType>

type OptionsType = {
  x?: number;                   // Horizontal position of the QR Code
  y?: number;                   // Vertical position of the QR Code
  height?: number;              // Height of the QR Code
  width?: number;               // Width of the QR Code
  quality?: number;             // JPEG quality for the final image
  backgroundColor?: string;     // Color for the background of the QR Code
  foregroundColor?: string;     // Color for the foreground of the QR Code
}

type ResultType = {
  uri: string;          // URI for the final image
  finalWidth: number,   // QR code final width
  finalHeight: number   // QR code final height
}

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

react-native-add-qrcode's People

Contributors

chriteixeira avatar dependabot[bot] avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.