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

micro-image-transformations

v3.0.0

Published

Microlibrary for image transformations.

Downloads

35

Readme

micro-image-transformations (v1.0.0)

travis build PRs Welcome An image processing microlibrary for Node and the web. Though I wrote this as a Node packages, I am targetting the web, for users who would like to modify web images. Unittests are written in mocha and chai Here is a link to a demo website I put together: [pending]

The npm package is currently v3.0.0 as I had to publish a few times for testing purposes.

Thank you Instrumental, your consideration means a lot to me. This project was an enjoyable learning experience!

Installation

npm install --save micro-image-transformations

For setting up browserify to use this npm pacakage, run npm install -g browserify Then pass the path of the js file that contains the image transform code browserify src/image_handler.js -o bundle.js Run this each time you make changes to the file or simply use watchify (another useful npm package).

If already installed, run npm update to check for and install new versions.

Example Usage

Suppose this js file is src/image_handler.js

  //include the 
  var imageTransformLibrary = require('micro-image-transformations');
  
  //grayscale transform
  var grayscaleImage=imageTransformLibrary.grayscale(img);
  
  //render it to canvas
  var context = document.getElementById('image-display').getContext('2d');
  context.drawImage(grayscaleImage,0,0);

Methods

  grayscale(image);  //averages values based on a luminosity equation. (humans are more sensitive to green)
  crop(image, startX, startY, cropWidth, cropHeight);  //uses cartesian coordinates (bottom left corner of image is (0,))

Supported Image Types

  • jpeg
  • png
  • gif
  • ico
  • may support additional image types like tiff and bmp (not tested)

Image Transformations Provided

  • grayscale - Turn an image into grayscale (luminosity correction algorithm used as humans are more sensitive to green)
  • crop - Crop an image.

Contributing

Clone this repository! Submit your PR and Travis will run some tests to make sure it is compliant with current standards.

Testing

In the cloned repository, to run tests, run npm test. Current tests are written in mocha and chai, testing grayscale and crop functions.

Note: eslint currently disabled due to some Travis complaints.

License

micro-image-transformations is licensed under the MIT license.