Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work with print() method #36

Open
YevhenKholevchuk2016 opened this issue Dec 8, 2020 · 0 comments
Open

Work with print() method #36

YevhenKholevchuk2016 opened this issue Dec 8, 2020 · 0 comments

Comments

@YevhenKholevchuk2016
Copy link

YevhenKholevchuk2016 commented Dec 8, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant