GithubHelp home page GithubHelp logo

combine-image's Introduction

combine-image

NPM

Combine multiple images into a single image

combine-image combines given images into a single image in right order. This will be helpful in a situation when you have to generate a preview of multiple images into a single image. This module is based on [Jimp] for image processing.

Install

$ npm install combine-image

Usage

import combineImage from 'combine-image';

combineImage(['image-1.png', 'image-2.jpg'])
  .then((img) => {
    // Save image as file
    img.write('out.png', () => console.log('done'));
  });

API

combineImage(images[, options])

  • images Array of (String | Object | Buffer | [Jimp]) - List of images to concat. If String is passed, it will be considered to the file path. Also you can pass other [Jimp] object. An Object entry can have following options:
    • src String or Buffer - A single image source to concat.
    • offsetX Number (optional) - x offset to affect this image. Default is 0.
    • offsetY Number (optional) - y offset to affect this image. Default is 0.
  • options Object (optional)
    • direction String - Direction of the merged image. If this value is col, the images will be merged vertically (col). Otherwise, If this value is row the images will be merged horizontally (row). Default is col.
    • color Number (hex) - Default background color represented by RGBA hex value. Default is 0x00000000.
    • offset Number - Offset in pixels between each image. Default is 0.
    • margin (Number | String | Object) - Margin of the result image. If Number or String is passed, it will be considered as standard css shorthand properties (e.g. '40 40 0 10'). An Object entry can have following options:
      • top Number (optional) - Margin on top side of result image. Default is 0.
      • right Number (optional) - Margin on right side of result image. Default is 0.
      • bottom Number (optional) - Margin on bottom side of result image. Default is 0.
      • left Number (optional) - Margin on left side of result image. Default is 0.

Returns a Promise that contains [Jimp] object.

combine-image's People

Contributors

danish1994 avatar

Watchers

James Cloos avatar Anurag Patel 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.