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

oversized-images

v0.0.3

Published

checks image sizes and creates a preview version

Downloads

2

Readme

Oversized

##creates a preview from oversized images

When you are working with professional camera equipment it is common that you encounter oversized picture resolutions that will cause rendering problems in a web context.

To prevent this, the Oversized package allows the dynamic creation of preview images. In order to make use of it, you have to browserify your project.

	npm install oversized-images

To require it, call:

	var oversized = require("oversized-images");

Then you create an oversized object:

	
	var reducer = new oversized({
	  		max: 1.4,
  			max_width: 1920,
  			max_height: 1080,
  			suffix: '_prvw'
  			});
  • max: affects all the pictures that have a size greater than max [in MB]
  • max-width: the maximal width of your preview
  • max-height: the maximal height of your preview
  • suffix: allows you to define the preview suffix
  • callback: callback function, receives the array of files that suffices the preview condition

To invoke the reduction process, call

	reducer.check([files]);

The parameter files takes a directory, as single files or an array of files. If you choose a directory, the library uses a recursive directory search. Therefore, you can scan and manipulate all the embedded subfolders. Since the library uses Q promises, all the calls are chained. By using a callback you can use it asynchronously.

So your call might look like this:

  
    function done(result) {
      console.log("processed " + result);
  };

	var test = new Oversized({
	  max: 1.4,
	  max_width: 1920,
	  max_height: 1080,
	  callback: done,
	  });

	var a = test.check(["file1.jpg", "file2.jpg", "file3.jpg"]);

The callback gets an array of files that matches the preview conditions.