All Projects → whatl3y → Photosaic

whatl3y / Photosaic

Licence: mit
Create beautiful mosaics from images and photos

Programming Languages

typescript
32286 projects

Labels

Projects that are alternatives of or similar to Photosaic

Mellite
An environment for creating experimental computer-based music and sound art. Mirror of https://git.iem.at/sciss/Mellite
Stars: ✭ 76 (-42.86%)
Mutual labels:  art
Artist
ARTist's core implementation meant to be included in the art project. Provides ARTist APIs and boilerplate code for modules.
Stars: ✭ 97 (-27.07%)
Mutual labels:  art
Reproducible Image Denoising State Of The Art
Collection of popular and reproducible image denoising works.
Stars: ✭ 1,776 (+1235.34%)
Mutual labels:  art
The Zen Of Python Poster
🌀 A beautiful poster made to remind you of Tim Peters' renowned “Zen of Python”. The guiding principles of a Pythonista.
Stars: ✭ 79 (-40.6%)
Mutual labels:  art
Medium
Progressive WebGL toolkit for art.
Stars: ✭ 90 (-32.33%)
Mutual labels:  art
Tiles And Such
Archives of tilelable images/wallpapers
Stars: ✭ 101 (-24.06%)
Mutual labels:  art
Sandhook
Android ART Hook/Native Inline Hook/Single Instruction Hook - support 4.4 - 11.0 32/64 bit - Xposed API Compat
Stars: ✭ 1,172 (+781.2%)
Mutual labels:  art
Urpflanze
A library for developers who want to approach to creative coding, artists who want to approach coding and for those who find it fun to play with math.
Stars: ✭ 118 (-11.28%)
Mutual labels:  art
Visual Center
Proposed tool to better align logos in the center of a container.
Stars: ✭ 1,338 (+906.02%)
Mutual labels:  art
Lifesaver
Conway's Game of Life implemented as an artistic, abstract macOS screensaver and tvOS app using SpriteKit
Stars: ✭ 113 (-15.04%)
Mutual labels:  art
Shapes2d
Shapes2D for Unity3D - Make simple art assets quickly in Unity
Stars: ✭ 83 (-37.59%)
Mutual labels:  art
Official Bash Logo
Everything you need to start using the official GNU Bash logo
Stars: ✭ 89 (-33.08%)
Mutual labels:  art
Photomosaic Generator
photomosaic generator (image to image, video to video)
Stars: ✭ 106 (-20.3%)
Mutual labels:  art
Style Transfer.js
👨‍🎨️ Generate novel artistic images in Node.js
Stars: ✭ 78 (-41.35%)
Mutual labels:  art
Generative.fm
A platform for playing generative music in the browser.
Stars: ✭ 1,534 (+1053.38%)
Mutual labels:  art
Icon Machine
Web application for randomly generating pixel art icons.
Stars: ✭ 73 (-45.11%)
Mutual labels:  art
Talk Generator
talk-generator is capable of generating coherent slide decks based on a single topic suggestion.
Stars: ✭ 101 (-24.06%)
Mutual labels:  art
Geometrize Haxe Web
🌐 Web demo using the Geometrize Haxe library to recreate images with geometric primitives
Stars: ✭ 122 (-8.27%)
Mutual labels:  art
Pxlsrt
Pixel sorter written in Ruby
Stars: ✭ 119 (-10.53%)
Mutual labels:  art
Wafflejs.github.io
A night of code, waffles, and karaoke.
Stars: ✭ 108 (-18.8%)
Mutual labels:  art

photosaic

Create beautiful mosaics of an image from an original you specify, and are made up of many small images/photos you also provide!

Install

$ npm install -s photosaic

Usage

import fs from 'fs'
import Photosaic from 'photosaic'

const mosaic = Photosaic(`./targetImgForMosaic.png`, [
  `./subImg1.png`,
  `./subImg2.png`,
  `./subImg3.png`,
])
const finalMosaicBuffer = await mosaic.build()
await fs.promises.writeFile(`./finalMosaic.png`, finalMosaicBuffer)

Main Image Type

  • type PhotosaicImage = string | Buffer | Readable: main abstraction of an "image" used by Photosaic
    • string: the full file path of the image on the local file system
    • Buffer: a raw buffer of an image
    • Readable: a readable stream of an image to be piped to a writable stream

Constructor

  • Photosaic(sourceImg, subImages, options?): factory function containing functionality to build mosaics
    • sourceImg: PhotosaicImage: The image of the final mosaic that will be created
    • subImages: PhotosaicImage[]: The small, subImages that will be used to build the mosaic
    • options?: additional options you can provide to customize the output mosaic created
      • options.gridNum?: number = 10: The final mosaic will be made up of a gridNum x gridNum grid of subImages
      • options.intensity?: number = 0.5: Number between 0-1 indicating the opacity of the shading on the subImages to help make the output image clearer. 0 is fully transparent shading (main image will be impossible to see), 1 is fully opaque (subImages will be impossible to make out). The default of 0.5 should be fine in most cases.
      • options.outputType?: string = 'png': The output type of the final mosaic. To preserve transparency in the image, use the default, 'png'.
      • options.outputWidth?: number = 400: Number of pixels the output mosaic's width will be (height will auto scale). The larger the width, the bigger the mosaic and the larger in size the final mosaic will be. The larger the output the longer it takes to generate a mosaic
      • options.algo?: 'closestColor' | 'random' = 'closestColor': How the subImages will be dispersed throughout when building the mosaic.
        • 'random' selects one of the subImages randomly each iteration to be inserted in that slice of the mosaic
        • 'closestColor' selects the subImage that is closest to the average color of the slice of the main image that the subImage is getting inserted to build the mosaic.

options.algo differences

closestColor

random

Methods

Assuming const photosaic = Photosaic(source, subImgs, opts), the methods below are exposed on photosaic

  • photosaic.build(): Promise<Buffer>: create a mosaic and return the result in a raw Buffer
  • photosaic.setSourceImage(newSrc: PhotosaicImage) => PhotosaicImage: reset source image created in mosaic
  • photosaic.setSubImages(subImgs: PhotosaicImage[]) => PhotosaicImage[]: reset subImages used to build mosaic
  • photosaic.addSubImage(img: PhotosaicImage): PhotosaicImage[]: add an image to the subImage list to build mosaic
  • photosaic.imgToStream(img: PhotosaicImage): Readable: convert a PhotosaicImage to a Readable stream
  • photosaic.imgToBuffer(img: PhotosaicImage): Promise<Buffer>: convert a PhotosaicImage to a raw Buffer

Tracking Mosaic Progress

Depending on the options provided (specifically gridNum and outputWidth) and the hardware you're running to build the mosaic, it could take several to tens of minutes for photosaic.build() to complete. Therefore, photosaic has an EventEmitter, photosaic.emitter you can listen for processing events to get the progress of the mosaic being built.

There will be a total of 2 * gridNum^2 iterations processed.

const photosaic = Photosaic(source, subImgs, opts)
photosaic.emitter.on('processing', (iteration) => {
  console.log(`Currently processing '${iteration}' subImage for the mosaic`)
})
await photosaic.build()

// Currently processing '1' subImage for the mosaic
// Currently processing '2' subImage for the mosaic
// Currently processing '3' subImage for the mosaic
// ...

CLI Task

You can use the following task to create a mosaic via the CLI with files on your local file system.

$ npm install -s photosaic
$ node ./node_modules/photosaic/dist/tasks/createMosaic.js -i ./pathToMosaicFile.js --dir ./path/to/sub/images -g 40 -w 1000
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].