exuanbo / gulp-jimp-wrapper Goto Github PK
View Code? Open in Web Editor NEWManipulates images using Jimp.
License: MIT License
Manipulates images using Jimp.
License: MIT License
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.
Please, add some kind of a check for callback result, because I just miss to call return in my callback and it gave me an error kind of:
(node:16) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getBufferAsync' of undefined
at jimp__default.default.read.then.then.img (/srv/app/node_modules/gulp-jimp-wrapper/dist/index.js:35:24)
at <anonymous>
The first thing I thought about it was that there is something wrong with the package, but, fortunately, there was not. After a little debugging I found out the reason was my own inaccuracy. It's not fatal, but I just would appreciate it if you add some checks and a more understandable exception for that.
Thank you for your time in advance.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are currently rate-limited. Click on a checkbox below to force their creation now.
These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
package.json
jimp 0.16.1
plugin-error 1.0.1
through2 4.0.2
@rollup/plugin-commonjs 16.0.0
chai 4.2.0
gulp 4.0.2
mocha 8.2.1
rimraf 3.0.2
rollup 2.37.1
ts-standardx 0.5.2-0
vinyl 2.2.1
.travis.yml
node 12
I am currently trying to make a watermark using gulp-jimp-wrapper via print() method
(https://github.com/oliver-moran/jimp/tree/master/packages/plugin-print)
import {src, dest} from 'gulp';
import pump from 'pump';
import jimp from 'gulp-jimp-wrapper';
const font = jimp.loadFont(jimp.FONT_SANS_32_BLACK);
export function images(inputImages, outputImages, cb) {
return pump([
src(inputImages),
jimp(image => image.print(font, 0, 0, {
text: 'hello word',
alignmentX: jimp.HORIZONTAL_ALIGN_CENTER,
alignmentY: jimp.VERTICAL_ALIGN_MIDDLE
})),
dest(outputImages)
], cb);
}
and when I call this module via:
// define gulp plugins
import {series} from 'gulp';
import del from 'del';
// import gulp tasks and source files
import {images} from './gulp-tasks/images';
import {publicSource, devSource} from './gulp-tasks/pathSrc';
// clean css && js dest directory
export const clean = () => del(publicSource.images);
//copy images
export const watermarkImages = cb => images(
devSource.images,
publicSource.images,
cb
);
// default task
export default series(
clean,
watermarkImages
);
I get an error:
TypeError: _gulpJimpWrapper.default.loadFont is not a function
at Object.<anonymous> (/Users/user/Downloads/Code/watermark/gulp-tasks/images.js:5:19)
at Module._compile (internal/modules/cjs/loader.js:816:30)
at Module._compile (/Users/user/Downloads/Code/watermark/node_modules/pirates/lib/index.js:99:24)
at Module._extensions..js (internal/modules/cjs/loader.js:827:10)
at Object.newLoader [as .js] (/Users/user/Downloads/Code/watermark/node_modules/pirates/lib/index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:685:32)
at Function.Module._load (internal/modules/cjs/loader.js:620:12)
at Module.require (internal/modules/cjs/loader.js:723:19)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (/Users/user/Downloads/Code/watermark/gulpfile.babel.js:6:1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `gulp`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/user/.npm/_logs/2020-12-08T15_28_01_969Z-debug.log
If you have an any idea what is happening, it will be great.
After the latest update (1.1.0), I keep retrieving the same exception while trying to use the package. The exception is:
TypeError: Cannot read property 'slice' of undefined
at getMIMEType (/srv/app/node_modules/gulp-jimp-wrapper/dist/index.js:25:51)
at Transform.through__default.default.obj [as _transform] (/srv/app/node_modules/gulp-jimp-wrapper/dist/index.js:62:24)
at Transform._read (/srv/app/node_modules/gulp-jimp-wrapper/node_modules/readable-stream/lib/_stream_transform.js:177:10)
at Transform._write (/srv/app/node_modules/gulp-jimp-wrapper/node_modules/readable-stream/lib/_stream_transform.js:164:83)
at doWrite (/srv/app/node_modules/gulp-jimp-wrapper/node_modules/readable-stream/lib/_stream_writable.js:409:139)
at writeOrBuffer (/srv/app/node_modules/gulp-jimp-wrapper/node_modules/readable-stream/lib/_stream_writable.js:398:5)
at Transform.Writable.write (/srv/app/node_modules/gulp-jimp-wrapper/node_modules/readable-stream/lib/_stream_writable.js:307:11)
at write (/srv/app/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:623:24)
at flow (/srv/app/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:632:7)
at DestroyableTransform.pipeOnReadable (/srv/app/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:664:5)
And I am using the package like this:
return gulp.src(imagesConfig.source)
.pipe(function (image) {
image.resize(size.width, size.height);
image.crop(crop.x, crop.y, crop.width, crop.height);
return image;
})
.pipe(gulp.dest(imagesConfig.destination));
Is there any solution for me in this situation?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.