image-to-uri

1.0.0 • Public • Published

Table of Contents

Convert image file to data URI



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.

    Package Sidebar

    Install

    npm i image-to-uri

    Weekly Downloads

    245

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • tiaanduplessis