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" />
<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" />
<img src="https://img.shields.io/github/watchers/tiaanduplessis/image-to-uri.svg?style=social" alt="Github Watch Badge" />
<img src="https://img.shields.io/github/stars/tiaanduplessis/image-to-uri.svg?style=social" alt="Github Star Badge" />
<img src="https://img.shields.io/twitter/url/https/github.com/tiaanduplessis/image-to-uri.svg?style=social" alt="Tweet" />
Built with ❤︎ by Tiaan and contributors
Table of Contents
Table of ContentsInstall
$ 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.