Socket
Socket
Sign inDemoInstall

@aftership/grunt-resize-crop

Package Overview
Dependencies
34
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @aftership/grunt-resize-crop

Make images a specific size without distorting the aspect ratio. Resizes as close as possible and crops the rest.


Version published
Maintainers
1
Install size
240 kB
Created

Readme

Source

grunt-resize-crop Build Status

Make images a specific size without distorting the aspect ratio. Resizes as close as possible and crops the rest.

This plugin is a wrapper for resize-crop

Getting Started

This plugin requires Grunt ~0.4.4 -- Learn to use Grunt

Install the plugin with this command:

npm install grunt-resize-crop --save-dev

Enable in your Gruntfile with:

grunt.loadNpmTasks('grunt-resize-crop');

The "resize_crop" task

In your project's Gruntfile, add a section named resize_crop to the data object passed into grunt.initConfig().

grunt.initConfig({
  resize_crop: {
    image_group: {
      options: {
        gravity: "center",
        height: 200,
        width: 200
      },
      files: [{
        expand: true, // Enable dynamic expansion.
        cwd: 'img/src', // Src matches are relative to this path.
        src: ['**/*_[0-9].jpg'], // Actual pattern(s) to match.
        dest: 'img/dist' // Destination path prefix.
      }]
    }
  }
});

Options

options.height

  • REQUIRED OPTION
  • Type: integer
  • Description: Sets the height in pixels to be used for the output image.

options.width

  • REQUIRED OPTION
  • Type: integer
  • Description: Sets the width in pixels to be used for the output image.

options.gravity

  • Type: string
  • Description: Determines the part of the image that will be removed during cropping. For example, "center" will try to keep the centermost part of the image and only remove the furthest edges.

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.

Keywords

FAQs

Last updated on 09 Nov 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc