gulp-responsive
gulp-responsive copied to clipboard
Cannot convert JPG files: Error: Input buffer contains unsupported image format
While it converts PNG images without any problem, It cannot convert any jpg/jpeg image,
I get this error:
File
foo.jpg: Input buffer contains unsupported image format
images are valid,
$ identify assets/images/foo.jpg
assets/images/foo.jpg JPEG 1600x901 1600x901+0+0 8-bit sRGB 222KB 0.000u 0:00.000
this is the task
var plumber = require('gulp-plumber');
// Test subfolders
gulp.task('responsive-subfolders', function () {
gulp.src(['./assets/images/**/*.{jpg,png}'])
.pipe(plumber())
.pipe(responsive(
{
'**/*.png': {
width: 16,
quality: 80,
},
'**/*.jpg': {
width: 200,
quality: 80,
}
}, {
errorOnUnusedConfig: false,
errorOnUnusedImage: false,
errorOnEnlargement: false,
}
))
.pipe($.plumber())
.pipe(gulp.dest('./tmp/'));
});
and here's the full error with gulp-plumber
[02:37:34] Plumber found unhandled error:
Error in plugin 'gulp-responsive'
Message:
File `foo.jpg`: Input buffer contains unsupported image format
quality: use jpeg({ quality: ... }), webp({ quality: ... }) and/or tiff({ quality: ... }) instead
progressive: use jpeg({ progressive: ... }) and/or png({ progressive: ... }) instead
withoutChromaSubsampling: use jpeg({ chromaSubsampling: "4:4:4" }) instead
compressionLevel: use png({ compressionLevel: ... }) instead
wondering if there is something wrong with my system
Hi @eksperimental
It seems the file is corrupted or not supported by https://github.com/jcupitt/libvips
Could you share this file?
This @mahnunchik, thank you for your answer.
In my previous example I have used the identify command from ImageMagick to determine the validity of the image, and it said it was fine (but it was was compressed by www.tinyjpg.com)
But it has happenedwith every JPG i have tried so far (even with images straight from a camera) I have used, this image https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg and the problem reamins.. any ideas?
Hi @eksperimental
It seems this issue is not related to the images itself.
Try to do the following steps:
- Remove all
gulp-plugins exceptgulp-responsivefrom the pipeline - Upgrade or rebuild gulp-responsive (and sharp)
- Upgrade nodejs