npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

thumbnail-pixeliser

v0.0.4

Published

Small app to render images using a database of other smaller sub-images.

Downloads

2

Readme

Welcome to thumbnail-pixeliser 👋

Version License: ISC

Small app to render images using a database of other smaller sub-images.

🏠 Homepage

Install

You need mongodb already installed. Name the database as thumbnailpixeliser and make sure it doesn't need credentials.

npm install thumbnail-pixeliser

Usage

NB. node 15 is required to be installed. If you are using Node 14, then you will need to either invoke using the second syntaxes, or modify the thumbnail-pixeliser binary script to insert the following at the top:

#!/bin/sh 
":" //# comment; exec /usr/bin/env node --max-old-space-size=7192 --experimental-modules --experimental-specifier-resolution=node "$0" "$@"

Build the thumbnail database for specific divisions with:

thumbnail-pixeliser --build --thumbnails="<thumbnail source folder>" --divisions-x=<1,2,4,8,etc.> --divisions-y=<1,2,4,8,etc.>

node --max-old-space-size=7192 --experimental-modules --experimental-specifier-resolution=node dist/cli.js --build --thumbnails="<thumbnail source folder>" --divisions-x=<1,2,4,8,etc.> --divisions-y=<1,2,4,8,etc.>

Once you have built a database division set you can use it to render images, e.g. for an 8 division set...

thumbnail-pixeliser --src="<source image file>" --dest="<output image file.jpg>" --thumbnails="<thumbnail source folder>" --divisions-x=8 --divisions-y=8 --blocks-x=96 --ratio-y=1.333 --dest-width=3000 --once-only

node --max-old-space-size=7192 --experimental-modules --experimental-specifier-resolution=node dist/cli.js --src="<source image file>" --dest="<output image file.jpg>" --thumbnails="<thumbnail source folder>" --divisions-x=8 --divisions-y=8 --blocks-x=96 --ratio-y=1.333 --dest-width=3000 --once-only

src can be JPEG/PNG, dest is JPEG.

The thumbnails path needs to point to your large filestore of thumbnail images to use as pixels.

divisions-x/y are the number of sub-pixel divisions used in each thumbnail. For example, 4 means that each thumbnail is broken into 4 sub-pictures when used for matching against a desired pixel pattern. Used in combination with blocks.

blocks-x/y is the number of blocks to divide the source image into. For example, a 2000 width pixel source image broken into 100 blocks-x results in 20 pixel wide books. Instead of specifying the blocks-y, a ratio-y can be used instead, which automatically works out the blocks-y based upon blocks-x and that ratio. The ratio should correspond to the approximate thumbnail portrait/landscape ratio. 1.33 is good for book covers.

NB. The source image size must be equal to or greater than blocks * divisions. So width must be greater than blocks-x * divisions-x. To use small source images, either use a separate program to resize them to a larger size (quality loss through this isn't important), or reduce the number of divisions or blocks. For the above example, 8 divisions with 96 blocks means your source image needs to be a minimum of 768 pixels wide.

dest-width is the destination image width, which will probably want to be larger than the source width in order to have clarity of the thumbnails. Generally use something like 30 pixels * blocks, e.g. width = 30 * 100 blocks = 3000.

once-only tells the rendering engine to only use each thumbnail once. This requires a LOT more thumbnails, and can result in slightly more random colour matching, but is a more impressive picture. Omiting this allows each thumbnail to be used as many times as necessary to best match the pixel patterns. If you have a low number of thumbnails and a source image with relately large blocks of the same colour, this can result in the same thumbnail being repeated.

Author

👤 Pete Morris

Show your support

Give a ⭐️ if this project helped you!


This README was generated with ❤️ by readme-md-generator