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

shareimage

v5.1.0

Published

Generate Social Media Preview Images from templates.

Downloads

12

Readme

ShareImage

Card

Installation

There is currently 2 Langauges Supported: Python and Node.js And there is a API available to use with your project!

API (Beta)

The API is currently in beta and may have some issues. The domain of the API is https://shimg.zype.cf/v1 Currently, the V2 of ShareImage is only available for the Node.JS Library (with CommonJS, ESM and TypeScript support)

Endpoints

There is currently only one endpoint available:

GET /image

It needs Query Params in the following format: https://shimg.zype.cf/v1/image?paramName=paramValue The paramaters are as same as Node.js Params!

Python

To Install ShareImage in Python with PIP Run:

pip install ShareImage

Node.js

To Install ShareImage in Node.js with NPM Run:

npm i shareimage --save

Or, with Yarn:

yarn add shareimage

Usage

Using ShareImage is a bit different across Languages.

Python

Use the Following Code to Generate a Image and print it's URL in Python:

from ShareImage import ShareImage

image = ShareImage(
    title = "My Test Image",
    cloudName = "myCloud",
    imagePublicId = "myFolder/myImage"
)

print(image)

Node.js

Use the Following Code to Generate a Image and output it's URL in Node.js (ES6):

import * as ShareImage from 'shareimage';

const image = await ShareImage.generateImage(
    "/path/to/image.png",
    "My awesome title",
    { type: "datauri" }
)

console.log(image)

Parameters

There are only 2 Required Parameters and several optional params.

Required Parameters

| Parameter | Type | Description | | :-------------: | :----: | :-------------------------------------------: | | src | String | URL/Buffer of the Image | | title | String | Title of the Image |

Optional Parameters

output Object (3rd parameter)

| Parameter | Type | Default | Description | | :-------: | :---: | :-----: | :-----------------------------------------------------------------------------------------------------------------------------------------------------: | | type | String | base64 | The format of the output. Can be buffer, datauri, base64, or file (Save the file in FS). This option is necessary but comes with default value. | | options | Object | {} | This option is necessary if type is set to file. The structure of the options Object is {options: {file: {path: "/file/to/output.png"}}} |

props Object (4th parameter)

| Parameter | Type | Default | Description | | :------------------: | :-----: | :------------------------: | :----------------------------------------------------------------: | | tagline | String | None | Tagline of Website or Tags of Post | | titleFont |ShareFont| sirin-stencil | Font of Title | | titleExtraConfig | String | '' | Extra Title Config | | taglineExtraConfig | String | '' | Extra Config of Tagline | | taglineFont |ShareFont| arial | Font of Tagline | | imageWidth | Number | 1280 | Width of Image | | imageHeight | Number | 669 | Height of Image | | textAreaWidth | Number | 760 | Width of TextArea | | textLeftOffset | Number | 480 | Left Offset of Text | | titleGravity | String | south_west | Gravity of Title | | taglineGravity | String | north_west | Gravity of Tagline | | titleLeftOffset | Number | None | Left Offset of Title | | taglineLeftOffset | Number | None | Left Offset of Tagline | | titleBottomOffset | Number | 254 | Bottom Offset of Title | | taglineTopOffset | Number | 445 | Top Offset of Tagline | | textColor | String | 000000 | Color of Text | | titleColor | String | None | Color of Title (If not provided textColor will be used instead | | taglineColor | String | None | Color of Tagline (If not provided textColor will be used instead | | titleFontSize | Number | 64 | Font Size of Title | | taglineFontSize | Number | 48 | Font Size of Tagline |

Note: If you don't provide Tagline, Parameters with tagline Prefix will be ignored.
We may add more Customization to ShareImage in the Future.

Sponsors

We have been sponsored by Vercel, MacStadium.
Vercel gave us free Pro Plan access to host the documentation and other websites.
MacStadium gave us free Mac Mini Server to host the API and for builds.

Powered By Vercel