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

imgcompress

v0.1.0

Published

Batch Minify PNG and JPEG images, Ideas come from [grunt-contrib-imagemin](https://github.com/gruntjs/grunt-contrib-imagemin)

Downloads

8

Readme

imgcompress

Batch Minify PNG and JPEG images, Ideas come from grunt-contrib-imagemin

Note that this is not an official Grunt plugin release! If you want to use this in a project, please be sure to follow the instructions for installing development versions, as outlined in the Installing Grunt guide.

Getting Started

This plugin requires Grunt ~0.4.0

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install imgcompress --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('imgcompress');

Imgcompress task

Run this task with the grunt imgcompress command.

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

Minify images using OptiPNG and jpegtran.

Options

optimizationLevel (png only)

Type: Number
Default: 0

Select optimization level between 0 and 7.

The optimization level 0 enables a set of optimization operations that require minimal effort. There will be no changes to image attributes like bit depth or color type, and no recompression of existing IDAT datastreams. The optimization level 1 enables a single IDAT compression trial. The trial chosen is what. OptiPNG thinks it’s probably the most effective. The optimization levels 2 and higher enable multiple IDAT compression trials; the higher the level, the more trials.

Level and trials:

  1. 1 trial
  2. 8 trials
  3. 16 trials
  4. 24 trials
  5. 48 trials
  6. 120 trials
  7. 240 trials

progressive (jpg only)

Type: Boolean
Default: false

Lossless conversion to progressive.

duplication

Type: String
Default: override

available override, error

destination file duplication, log an error message if chose error, override exist file and log an override message if chose override

childs

Type: number Default: 30

spawn how many child threads at most to help optimaze image

recurse

Type: Boolean Default: true

recurse sub directory

ignores

Type: string or array Default: null

ignores these files that match this, files that are not png, jpg or jpeg will be ignored automatic use grunt.util.match with the options {matchBase: true}

Example config

grunt.initConfig ({
	imgcompress: {
		options: {
			optimizationLevel: 3
			progressive: true 	
			duplication: 'override'
			childs: 30		
			recurse: false 
			ignores: ['*.png']
		}
			

		dist: {
			files: {
				'tmp/bar.jpg': 'imgs/test/test.jpg',
				'tmp': ['imgs/test', 'imgs/test_1']
			}
		}
			
		dist2: {
			files: [
				{ src: 'test', dest: 'tmp' }
			]
		}
	}	
})

grunt.registerTask('default', ['imgcompress:dist']);

Release History

  • 2013-06-29   v0.1.0   Initial release.

Task submitted by ZhongleiQiu

This file was generated on Sat Jun 29 2013 10:29:41.