🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@fugood/image-mosaic

Package Overview
Dependencies
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fugood/image-mosaic

Creates an image mosaic, this package was forked from [`react-image-mosaic`](https://github.com/thejsn/react-image-mosaic) and used [`node-canvas`](https://github.com/Automattic/node-canvas).

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
3
Maintainers
4
Weekly downloads
 
Created
Source

@fugood/image-mosaic Build Status NPM version

Creates an image mosaic, this package was forked from react-image-mosaic and used node-canvas.

Installation

$ yarn add @fugood/image-mosaic

Usage

See the test as usage, you can also refer to the test fixtures and image snapshots.

import mosaic from '@fugood/image-mosaic'

mosaic({
  // The width of the canvas.
  width: 400,
  // The height of the canvas.
  height: 400,
  // The number of columns of images in the mosaic.
  columns: 40,
  // The number of rows of images in the mosaic.
  rows: 40,
  // The amount of blending between each image and its matching color. A number between 0 and 1.
  colorBlending: 0.8,
  // The target image to recreate. Can be a string or an image, the string is assumed to be a url to an image. Expected file buffer.
  target: fs.readFileSync('path/to/image'),
  // An array with urls to images to be used to build the mosaic.
  sources: [
    fs.readFileSync('path/to/image1'),
    fs.readFileSync('path/to/image2'),
  ],
}).then(canvas => {
  const result = canvas.toBuffer()
})

See the documentation of node-canvas for more output methods.

License

MIT

Keywords

image

FAQs

Package last updated on 23 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts