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

imagegenerator

v0.0.41

Published

Generate PNG Image for a Quote provided

Downloads

60

Readme

ImageGenerator

Generate PNG Images for a Quote provided.

A Typescript- Node Module for Generating PNG Image.

Installation

npm install imagegenerator

Usage

  • Generate Image with a Quote
import ImageGenerator from 'ImageGenerator'

let image = new ImageGenerator()
image.addQuote("When you want something, all the universe conspires in helping you to achieve it.")
image.imageStyle({backgroundImage: "background.jpg",color: 'rgba(0,0,0,0.8)',fontFamily:'Open Sans', fontSize: 30, padding: 30})
image.addWatermark({imageurl:"watermark.png", position:ImageGenerator.watermarkPosition.BOTTOMRIGHT})
image.generateImageSync('quote.png')
  • Example Output

alt tag

Constructor

new ImageGenerator()
new ImageGenerator("quote")
new ImageGenerator("quote",{ImageProperties})

Methods

  • Adding a Quote to Image
image.addQuote("<Your Quote Here>");
  • Generate Image Synchronously
image.generateImageSync('<OutputFilePath>.png')
  • Adding a Watermark to Image

//Properties of Watermark
 watermark: WatermarkProperties = {
    imageurl: string, // Path  to Image URL/HTML
    position: ImageGenerator.watermarkPosition.BOTTOMRIGHT | ImageGenerator.watermarkPosition.BOTTOMLEFT | ImageGenerator.watermarkPosition.TOPRIGHT | ImageGenerator.watermarkPosition.TOPLEFT
}


//Object as Argument
image.addWatermark({ 
    imageurl: <Path to Image URL/Local Path>,
    position: ImageGenerator.watermarkPosition.BOTTOMRIGHT | ImageGenerator.watermarkPosition.BOTTOMLEFT | ImageGenerator.watermarkPosition.TOPRIGHT | ImageGenerator.watermarkPosition.TOPLEFT
 });

  • Styles to Image

//Properties of Styles
 imgProps: ImageProperties = {
   backgroundColor?: string;  // Background of the Image - Color
    backgroundImage?: string;  //Background of the Image - Image as Background
    color?: string;  // Font Color
    fontFamily?: string;  // Font Family
    fontSize?: number;  //Font Size
    height?: number;  //Height of the Image
    width?: number;  //Width of the Image
    padding?: number;   //Padding around Text
    textAlign?: string; //Text Align
    wordWrap?: string;   //Word Wrapping
    verticalAlign?: string;  // Vertical Aligning
    backgroundSize?: string;  //Background Sizing 
    fontStyle?: string;   //Italic / Oblique / None
    textDecoration?: string; // Underline/Strikethrough 
}


//Object as Argument
image.imageStyle({ 
    backgroundColor: "#fff", 
    backgroundImage: "", 
    color: "#000", 
    fontFamily: "sans-serif", 
    fontSize: 25, 
    height: 500, 
    width: 500, 
    backgroundSize: "cover", 
    padding: 10, 
    textAlign: 'center', 
    wordWrap: 'break-word', 
    verticalAlign: 'middle', 
    fontStyle: 'none', 
    textDecoration: 'none' 
 });