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

imagix

v0.2.6

Published

Simple and clean image manipulation using jimp, npm package imagix

Downloads

10

Readme

Imagix

Imagix is ​​a framework for jimp to manipulate images in a simpler and cleaner way.

Installation

$ npm install --save imagix

Example usage

// references the classes to use
const { ImagixRead, ImagixFont, ImagixImage } = require('imagix');


// create a new font to print, use the ImagixFont class
let text1 = new ImagixFont('text to print', 20, 100,
                // text a print, point in X, point in Y       
    {
    //Options for a font
        size: 32, // size of the font
        color: 'WHITE' // color of the font 

    });

// create a new image to print, use the ImagixImage class
let img1 = new ImagixImage('avatar.png', {
    //Options for a image
        x: 15,   // point in X
        y: 45,   // point in Y
        resizeX: 130,  //define  the size in X of the image.
        resizeY: 120,  //define the size in Y of the image.
    });


/* 
The ImagixRead class takes the fonts and images in arrays 
and returns the getBuffer method. 

*/

const image = new ImagixRead('image-bg.png', [text1], [img1]);
// image to manipulation image-bg.png
// if you have more than one font "[text1, text2, text3]" or images "[img1, img2]"


//Metods options getBuffer, getWrite, getInks
//print image manipulation

//getWrite
image.getWrite('newImage.png');

//getBuffer
image.getBuffer(buff => {
    console.log(buff);
        
});

//getInks, opts for all Jimp's methods
image.getInks(img => {
    img.invert(function (err, img) {
        img.write('newImgInvert.png');
	});

};

OPTIONS A FONT

//Available options

size:
 "8"    //Open Sans, 8px
 "16"   //Open Sans, 16px
 "32"   //Open Sans, 32px
 "64"   //Open Sans, 64px
 "128"  //Open Sans, 128px

color: 
"BLACK" //Open Sans, Black
"WHITE" //Open Sans, White

SUMMARIZED EXAMPLE

const { ImagixRead, ImagixFont, ImagixImage } = require('imagix');

let nick = new ImagixFont('Nickname', 20, 100,     
    {
        size: 32, 
        color: 'WHITE'
    });

let info = new ImagixFont('[email protected]', 20, 300,
    {
        size: 16, 
        color: 'BLACK'
    });

let avatar = new ImagixImage('www.example.com/asset/avatar.png', {
        x: 15,
				y: 45,
				resizeX: 250,
				resizeY: 230
    });

const image = new ImagixRead('bg-profile-1.png', [nick, info], [avatar]);


image.getWrite('./img/newProfile-1.png');

//Or
image.getBuffer(buff => {
    console.log(buff);

});