crashes if image is too small
events.js:160
throw er; // Unhandled 'error' event
^
Error: File `X_logo.jpg`: Image enlargement is detected
real width: 153px, required width: 200px
(sharp:3559): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(sharp:3559): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(sharp:3559): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(sharp:3559): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(sharp:3559): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
Hi @rubycut
Options: withoutEnlargement and errorOnEnlargement may help you.
@mahnunchik , those options don't help at all, output is the same.
+1. Even if I set withoutEnlargement to true and errorOnEnlargment to false, I still get the same error when resizing images.
If I comment out this line then it works as expected (a warning is logged and the raw image is copied without resizing). Is it possible the errorOnEnlargment config isn't being plumbed through to here correctly?
+1 - I have the exact same issue.
What's strange is that it doesn't happen with all images.
Same issue here, on a 2000x350 image.
Same issue... any update?
(( same issue(
Hi @7iomka @tehtrav @andrewplummer @mattstratton @jqln-0
Are you using the global option errorOnEnlargement?
gulp.task('default', function () {
return gulp.src('src/*.png')
.pipe(responsive(config, {
errorOnEnlargement: false
}))
.pipe(gulp.dest('dist'));
});
Yes! That it works! My config:
withoutEnlargement: true,
skipOnEnlargement: false, // that option copy original file with/without renaming
errorOnEnlargement: false
Hi @7iomka
It is exactly what corresponds to your original question and how I use gulp-responsive myself 😉
There seems to be something more going on with this. Every time it hits an image that requires enlargement it dies, unless I set 'withoutEnlargement' to false. Gulp task is:
function imgResponsive() {
return gulp.src('src/img_tmp/**/*.{jpg,png}')
.pipe(plugins.responsive(config.responsiveOptions, config.responsiveGlobals))
.pipe(gulp.dest('src/img_responsive/'));
}
config.js contains:
responsiveGlobals: {
quality: 86,
progressive: true,
withMetadata: false,
withoutEnlargement: true,
errorOnEnglargement: false,
skipOnEnlargement: false,
errorOnUnusedConfig: false
},
Used to work in the distant past, tried rolling back versions of gulp-responsive and sharp but still get the same error.
Example error:
21:34:17] Error in plugin 'gulp-responsive'
Message:
File `Yarbus_EMs_Sonnet.jpg`: Image enlargement is detected
real width: 921px, required width: 1024px
Details:
domainEmitter: [object Object]
domain: [object Object]
domainThrown: false
[21:34:17] 'reprocess:responsive' errored after 8.13 s
(sharp:74647): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(sharp:74647): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(sharp:74647): GLib-CRITICAL **: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
(sharp:74647): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
[1] 74647 segmentation fault gulp reprocess:responsive
By playing with the config width parameters I can trigger the error with different images, depending on size. Workaround for now is allow enlargement (ick) or only generate sizes <= the smallest images width. On OSX 10.11.6 el capitan sharp 0.18.4 gulp-responsive 2.8.0 vips 8.5.9 installed via macports on macports installed python 3.4 (didn't seem to work on 2.7).
Hi @adrinux
Could you please try your config with build in shrap: http://sharp.dimens.io/en/stable/install/#mac-os
@lovell do you have any idea about the error above?
The GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed message usually means there are other images still being processed by the libuv-managed threadpool when process.exit() is manually called. Node does not wait for these threads to "join" before exiting and this can cause a segfault on shutdown as the event loop is not empty.
To avoid this, gulp-responsive could wait for sharp.counters().queue to reach zero before throwing errors, if any.
@mahnunchik I removed macports vips, also removed the separate copy of sharp I'd added to package.json, then removed my project's node_modules and ran npm install again. End result was '[1] 64556 illegal hardware instruction gulp reprocess:responsive' - and that's with config that was working (didn't trigger image enlargement warning).
Problem may not be in gulp-responsive I suppose
Edit to add: Reinstalled vips with macports and reinstalled gulp-responsive, now back to a working setup as long as I avoid triggering the image enlargement warning.