search

Home  >  Q&A  >  body text

node.js - 大家用啥图片压缩工具? 如 tinypng, 智图, imagemin之类的?

为何imagemin的压缩量这么小?

高洛峰高洛峰2867 days ago597

reply all(8)I'll reply

  • 黄舟

    黄舟2017-04-17 13:15:15

    Of course it cannot be suppressed by using default components and default parameters. Imagemin has to match the components and parameters by itself. . .

    Post paragraph written by myself:

    gulp.task('imgmin', function() {
        var jpgmin = imageminJpegRecompress({
                accurate: true,//高精度模式
                quality: "high",//图像质量:low, medium, high and veryhigh;
                method: "smallfry",//网格优化:mpe, ssim, ms-ssim and smallfry;
                min: 70,//最低质量
                loops: 0,//循环尝试次数, 默认为6;
                progressive: false,//基线优化
                subsample: "default"//子采样:default, disable;
            }),
            pngmin = imageminOptipng({
                optimizationLevel: 4
            });
        gulp.src(srcImage)
            .pipe(imagemin({
                use: [jpgmin, pngmin]
            }))
            .pipe(gulp.dest(dstImage));
    });

    The effect of compressing jpeg and png is good, but other formats have never been accessible, so I use the default processing.


    For tool software, I currently use Antelope. Just drag the file in and click Optimize.

    reply
    0
  • PHPz

    PHPz2017-04-17 13:15:15

    Write a few lines of code and compress it yourself

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 13:15:15

    http://www.atool.org/pngcompression.php I made it myself, supports jpg png, the effect is absolutely awesome...

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 13:15:15

    I used this plug-in https://www.npmjs.com/package/gulp-tinypng-compress
    The advantage is that the compression effect is very good and the image quality is guaranteed because https://tinypng is used. com his api.
    The disadvantage is that it takes a long time and there is a monthly quantity limit

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 13:15:15

    I use lwip

    reply
    0
  • PHPz

    PHPz2017-04-17 13:15:15

    fis3 is already built-in, forgot about it

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 13:15:15

    Pngquant

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 13:15:15

    There is no imagemin module in npm. I personally like to use gulp;
    can refer to the official demo. If you use the official demo, please change const to var. const is es6 syntax.

    const gulp = require('gulp');
    const imagemin = require('gulp-imagemin');
    const pngquant = require('imagemin-pngquant');
     
    gulp.task('default', () => {
        return gulp.src('src/images/*')
            .pipe(imagemin({
                progressive: true,
                svgoPlugins: [{removeViewBox: false}],
                use: [pngquant()]
            }))
            .pipe(gulp.dest('dist/images'));
    });

    reply
    0
  • Cancelreply