K
K
karpo5182018-09-07 15:24:23
JPEG
karpo518, 2018-09-07 15:24:23

Which plugin to choose in imagemin in gulp to optimize images for Google Pagespeed Insight?

You need to set a configuration to optimize the jpeg for occasional use on existing sites. It is important that after replacing the images there are no complaints about the quality of the images , but at the same time minimize the size of the files .
I used to use tools based on mozjpeg. Google's Developer Guidelines don't make it clear which compression method is best. Google gives an example of using the imageminMozjpeg plugin , which explicitly indicates the quality of 85. At the same time, the use of the imageminJpegRecompress
plugin is common among frontend developers and layout designers .. And Google recommends it too. As I understand it, this is the nodejs analogue of the jpeg-recompress tool from the jpeg-archive package. I’m not good friends with nodejs and I planned not to mess with it, but to write a bash script, but after looking in which direction frontend optimization tools are developing, I decided to choose gulp as a simpler and more convenient solution.
Ask those who know the topic to answer a few questions .

Questions

1. Какой из плагинов больше подходит для таких целей? imageminMozjpeg или imageminJpegRecompress
2. Какую конфигурацию imageminJpegRecompress следует использовать, чтобы получить на выходе аналог этому
gulp.task('mozjpeg', () =>
    gulp.src('src/*.jpg')
    .pipe(imagemin([imageminMozjpeg({
        quality: 85

    })]))
    .pipe(gulp.dest('dist'))
);

Меня смущают такие параметры как min, max и loops. Последний параметр вообще отсутствует в пакете jpeg-archive, а на github описывается слишком лаконично, чтобы уловить суть. Просьба прокомментировать данные опции.
3. Оба инструмента исключают необходимость использования jpegtran? Встречал конфигурацию:
gulp.task('mozjpeg', () =>
    gulp.src('src/*.jpg')
    .pipe(imagemin([imagemin.jpegtran({progressive: true}),
          imageminJpegRecompress({
    					loops: 6,
    					min: 80,
    					max: 95,
    					quality:'high'
          })]))
  .pipe(gulp.dest('dist'))

Полагаю, что параметр progressive можно перенести в imageminJpegRecompress/imageminMozjpeg и отказаться от jpegtran

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
David Halkin, 2018-09-08
@northfire

yes no. there are a lot of plugins and not a single norm compresses. I have a friend who compresses some kind of program under a poppy. I, if not too lazy, compress Google itself

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question