Git Product home page Git Product logo

gulp-images-resizer's Introduction

gulp-images-resizer

Stats
Images resizer for gulp

Install

$ npm install gulp-images-resizer

Usage

let resizer = require('gulp-images-resizer');

gulp.task('resize', function() {
    return gulp.src('src/**/*.*')
	.pipe(resizer({
            format: "png",
            width: "50%"
        }))
	.pipe(gulp.dest('dest/'));
});

Available options

  • verbose - log file processing options, each image as processed. Default: false
  • format - fromat of output files (png, jpg, gif, bmp or *). Default: *
  • width - width of output images (fixed, percentage or -1 for auto). Default: -1
  • height - height of output images (fixed, percentage or -1 for auto). Default: -1
  • noCrop - disable the crop feature. If true it will choose the max size between height/width. Default: false
  • quality - quality of output images (from 0 to 100). Default: 100
  • tinify - tinify images using TinyPNG. Default: false
  • tinifyKey - TinyPNG key. Default: ""

gulp-images-resizer's People

Contributors

khawkins98 avatar michaelmarkie avatar odrick avatar rtalon83 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

gulp-images-resizer's Issues

Decimal percentages

Hi!

Look this example:

I have a image 265x1200, now gulp-images-resizer is doing width = Math.floor(image.bitmap.width * (parseInt(width) / 100))

What happens when I set a float value? 66.6667%

parseInt(66.6667) -> 66
66 / 100 -> 0.66
265 * 0.66 = 174.9
Math.floor(174.9) -> 174

Correct value: 265 * 66.6667% = 176.66

two/three pixels of difference.

Maybe, will be:

Math.round(image.bitmap.width * (parseFloat(width) / 100))
Math.round(image.bitmap.height * (parseFloat(height) / 100))

no?

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.