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

picel

v0.0.1

Published

Picel accompanying tool for encoding images.

Downloads

4

Readme

picel-js Build Status NPM version NPM downloads

JavaScript library for string-encoding images to be served using the picel image processing service microservice / middleware.

Learn more about Picel by reading the project docs.

Install

Install via Bower, npm or clone the repo.

This encoder library works both with Node.JS and on browsers.

API

picel.encode(image)

Image is a JSON that can contain any of the following keys:

  • prefix: picel end-point
  • backend: image storage end-point (only when picel server is open / unrestricted)
  • path: path to the file relative to the backend server
  • raw: boolean flag to retrieve the original file
  • crop: {x, y, width, height}
  • width
  • height
  • output

All methods inside the price object that starts with _ (underscore) are to be considered private and you should not rely on them. The only reason it's not scoped inside of a closure is to facilitate testing (but that may change on the future).

Examples

It's pretty easy to compose image transformation urls using this library.

Let's start with

var img = {
    prefix: "http://localhost:8123/",
    path: "7386/11274440243_10456d457d_h.jpg"
};

From there we will extend the img object and invoke the picel.encode successively.

picel.encode(img);

returns http://localhost:8123/7386/11274440243__10456d457d__h

Which won't work unless you're using a single backend. If you aren't, you've to extend the img object:

img.backend = "https://farm8.staticflickr.com/";

picel.encode(img);

returns http://localhost:8123/s:farm8.staticflickr.com/7386/11274440243__10456d457d__h

If you want to crop:

img.crop = {
    x: 0,
    y: 10,
    width: 600,
    height: 600
};

picel.encode(img);

will return

http://localhost:8123/s:farm8.staticflickr.com/7386/11274440243__10456d457d__h_0x10:600x600

and so on.

By omitting the extension the server will serve you the more appropriate extension.

If you want to force an extension just use img.output = 'jpg', for example.

For example:

picel.encode({
    "path": "/foo.gif",
    "width": 600,
    "height": 400,
    "output": "webp"
})

should return /foo_600x400_gif.webp

More examples can be recovered from the picel-js/test/fixtures/encode.json test data provider file.