Giter Club home page Giter Club logo

grunt-imagemagick's Introduction

grunt-imagemagick

Adds utility tasks for grunt to access ImageMagick via the node_imagemagick package. You will need to have image magick CLI tools installed as described in the node_imagemagick readme. see node-imagemagick

Getting Started

Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-imagemagick

Then add this line to your project's grunt.js gruntfile:

grunt.loadNpmTasks('grunt-imagemagick');

Documentation

Example Usage

grunt.initConfig({
	"imagemagick-hisrc":{
	  dev:{
	    files:"**/*-2x.jpg",
	    suffix:["-2x","-1x","-low"],
	  }
	},"imagemagick-resize":{
	  dev:{
	    from:'test/',
	    to:'test/resized/',
	    files:'resizeme.jpg',
	    props:{
	      width:100
	    }
	  }
	},"imagemagick-convert":{
	  dev:{
	    args:['test/resizeme.jpg','-resize', '25x25', 'test/resized/resizeme-small.jpg']
	  }
	}
});

Error Handling

Errors comming from the underlying cli are just displayed as default, you can get a warning thrown if you like by configuring a flag:

grunt.initConfig({
	"imagemagick-convert":{
	  dev:{
	    args:['test/resizeme.jpg','-resize', '25x25', 'test/resized/resizeme-small.jpg'],
	    fatals: true
	  }
	}
});

This is only working for

  • imagemagick-resize
  • imagemagick-convert

Tasks

imagemagick-convert Use the args property to identify the list of arguments to pass to ImageMagick's convert command.

imagemagick-resize The following properties are valid:

  • from : The path where images will be pulled from.
  • to : The output path for the resized images.
  • files : The wildcard identifying the files to resize.
  • props : The properties to pass to the node_imagemagick "resize" method. See node-imagemagick

imagemagick-hisrc This is a little utility task which runs over a set of image files and creates three sizes of each using a specified naming convention. This is great for auto-generating the three image sizes accepted by HiSRC. The following properties are valid:

  • files : A wildcard identifying the files to resize, this should be a wildcard for the source image, which should be the full size retina image (2X)
  • suffix : An array of suffixes to use. The first is the suffix for the large image, the second and third are the medium (normal) and small respectively. The assumption is that the source image follows the identified convention.

If you have any questions, feel free to ask, if you have any ideas, feel free to contribute a pull :)

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Release History

0.1.4 First functional build on NPM 0.1.5 Added documentation

License

Copyright (c) 2012 Arne Strout
Licensed under the MIT license.

grunt-imagemagick's People

Contributors

arne-strout-icrossing avatar h-evers avatar hjhart avatar xzyfer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.