Giter Site home page Giter Site logo

iconifyit / image-to-icon-converter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from laander/image-to-icon-converter

0.0 1.0 0.0 87 KB

:waning_gibbous_moon: Convert images to icons with Iconfinder's Converter

Home Page: http://labs.iconfinder.com/converter

JavaScript 100.00%

image-to-icon-converter's Introduction

Image to icon converter

Convert images (png/jpg/gif) to icons (icns/ico)

This is a simple, unoffical node wrapper for Iconfinder's icon converter utility found here: http://labs.iconfinder.com/converter

Why?
Converting image files to the .icns format is surprisingly difficult to do programmatically on anything else than OSX (using Xcode). You got 'iconutil', 'sips' and 'libicns', but they are OSX only which leaves you in the dust when you want it to work on a linux webserver. Last resort are the myriad of online converters stuck in the 90s (and none of them have an API).

How?
Upload an image file through Iconfinder's API, they do their magic and you get an icon file back. Simple.

Features

  • Takes in any type of images (png/jpg/gif)
  • Outputs to most common icon types (icns/ico)
  • Returns A+/ES6 style promises
  • Supports streams so you can .pipe() files through

Installation

npm install image-to-icon-converter

Usage

Upload file from disk, convert it and get download URL:

var converter = require('image-to-icon-converter');
var file = __dirname + '/image.png';

converter.uploadConvertDownload(file, 'icns')
  .then(function(result) {
    // result is a URL to the resulting icon file
    console.log(result)
  });

If you supply it with a stream, it will return a stream too:

var converter = require('image-to-icon-converter');
var fs = require('fs');
var stream = fs.createReadStream(__dirname + '/image.png');

converter.uploadConvertDownload(stream, 'icns')
  .then(function(result) {
    // result is a stream of the icns file
    result.pipe(fs.createWriteStream('icon.icns'));
  });

You can also call each of methods individually (returns promises):

var converter = require('image-to-icon-converter');

converter.uploadStream(fileStream);
converter.uploadFile(pathToFile);
converter.convert(urlToFile, iconType);
converter.downloadFile(convertResult);
converter.downloadStream(convertResult);

image-to-icon-converter's People

Contributors

laander avatar

Watchers

James Cloos 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.