A
A
Art Root2016-08-17 08:56:55
Node.js
Art Root, 2016-08-17 08:56:55

What plugin can increase the resolution of images pix / inch?

I use this task to compress and optimize the image
Using plugins
https://www.npmjs.com/package/gulp-image-resize
https://www.npmjs.com/package/gulp-imagemin

gulp.src('src/img/*.{jpg,png}')
        .pipe(imageResize({
            width: 240,
            height: 160,
            crop: true,
            upscale: false
        }))
        .pipe(cache(imagemin({
            interlaced: true,
            progressive: true,
            svgoPlugins: [{
                removeViewBox: false
            }],
            use: [pngquant()]
        })))
        .pipe(rename({
            suffix: '-240x160'
        }))
        .pipe(gulp.dest('app/img/collection'));

But at the output, it makes the standard 72 pixels / inch for all images for the given sizes (even if the source is with a high resolution).
In what way can you make 240 pixels / inch at the output, for example?
I can't find anything in the documentation.
SOLUTION
The gulp-gm plugin solves the problem with dpi resolution and does not change it when resizing and cropping.
Replaced with this.
gm = require('gulp-gm')
.pipe(gm(function(gmfile, done) {
            gmfile.size(function(err, size) {
                var w = 150;
                var h = 100;
                done(null, gmfile
                    .density(240, 240)
                    .resize(w, h, '^')
                    .gravity('Center')
                    .crop(w, h, 0, 0)
                );
            });
        }))

However, this did not solve the quality problem on the retina, so I still had to increase the images by 2 times for clarity.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question