mosaikr
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

mosaikr

Create a mosaic from a list of images.

It uses Sharp to operate on images.

Install

Install with npm

npm install mosaikr

Usage

import { mosaikr } from 'mosaikr';
 
// This will create a 3x2 grid where each image is 200x200px
mosaikr({
  input: ['1.jpg', '2.jpg', '3.jpg', '4.jpg', '5.jpg', '6.jpg'],
  columns: 3,
  rows: 2,
  width: 600,
  height: 400,
  output: 'mosaic.jpg',
});
import { mosaikr } from 'mosaikr';
 
// This will do the same but it won't output the image.
// Instead, a Sharp object will be returned asynchronously to allow other operations
// (note that there's no output parameter here)
const img = await mosaikr({
  input: ['1.jpg', '2.jpg', '3.jpg', '4.jpg', '5.jpg', '6.jpg'],
  columns: 3,
  rows: 2,
  width: 600,
  height: 400,
});
 
// Now you can do whatever you want here
// (this code will do exactly the same as above)
img.toFormat('jpeg')
   .toFile('mosaic.jpg');

Package Sidebar

Install

npm i mosaikr

Weekly Downloads

2

Version

0.1.1

License

ISC

Unpacked Size

9.57 kB

Total Files

11

Last publish

Collaborators

  • danikaze