image-to-uri

Convert image file to data URI

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
image-to-uri
921.0.06 years ago6 years agoMinified + gzip package size for image-to-uri in KB

Readme

image-to-uri
Convert image file to data URI

<img src="https://img.shields.io/npm/v/image-to-uri.svg?style=flat-square" alt="Package version" />
Downloads
<img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard" />
<img src="https://img.shields.io/travis/tiaanduplessis/image-to-uri.svg?style=flat-square" alt="Travis Build" />
<img src="https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square" alt="Standard Readme" />
<img src="https://badge.fury.io/gh/tiaanduplessis%2Fimage-to-uri.svg?style=flat-square" alt="GitHub version" />
<img src="https://dependencyci.com/github/tiaanduplessis/image-to-uri/badge?style=flat-square" alt="Dependency CI" />
<img src="https://img.shields.io/npm/l/image-to-uri.svg?style=flat-square" alt="License" />
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square" alt="PRs" />
<img src="https://img.shields.io/badge/$-support-green.svg?style=flat-square" alt="Donate" />


Built with ❤︎ by Tiaan and contributors

Table of Contents

Table of Contents
  • Install
  • Usage
  • CLI
  • Contribute
  • License
  • Install

    $ npm install --save image-to-uri
    # OR
    $ yarn add image-to-uri

    Usage

    const imageToUri = require('image-to-uri')
    console.log(imageToUri('./example.jpg')) // data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQAB...

    Supported image types:
    • png
    • gif
    • jpg
    • jpeg
    • bm
    • bmp
    • webp
    • ico
    • svg

    CLI

    $ npm install --global image-to-uri
    # OR
    $ yarn global add image-to-uri

    Then:
    $ image-to-uri ./example.jpg
    # data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQAB...
    $ image-to-uri ./example.jpg | pbcopy
    # pipe to clipboard(macOS)

    Contribute

    Contributions are welcome. Please open up an issue or create PR if you would like to help out.
    Note: If editing the README, please conform to the standard-readme specification.

    License

    Licensed under the MIT License.