Skip to content

Output file is larger than input, aborting! #24

@mevl

Description

@mevl

Hello!
I use use gulp-image package with imagemin-jpeg-recompress plugin to optimize mutiple files:

gulp.task('images', config.img.description, wrapPipe(function (success, error) {
	return gulp
		.src(config.source, config.options)
		.pipe(imagemin([
			imageminJpegRecompress({ quality: 'low' })
		]).on('error', error))
		.pipe(gulp.dest(config.destination))
		.on('end', () => {
			notifier('Images have been minified.');
		}, success);
}));

If we get at least one non-optimizable file during processing, all output piping will be aborted:

[15:04:26] 'images' errored after 725 ms
[15:04:26] Error in plugin 'gulp-imagemin'
Message:
    Output file is larger than input, aborting!
Details:
    code: 1
    killed: false
    stdout: 
    stderr: Output file is larger than input, aborting!
    failed: true
    signal: null
    cmd: /raid/vhosts/files/node_modules/jpeg-recompress-bin/vendor/jpeg-recompress --quiet --quality low --strip /tmp/8bb35c3a-115a-4658-beb5-0be9b95e8141 /tmp/4e460681-5354-4941-891b-7dcfbb4babaf
    timedOut: false
    fileName: /full_file_name_is_here.jpg

How can I continue piping and just copy non-optimized file as-is to destination in this case?
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions