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

Optimize print function #564

Closed
chancein007 opened this issue Aug 22, 2018 · 2 comments · Fixed by #616
Closed

Optimize print function #564

chancein007 opened this issue Aug 22, 2018 · 2 comments · Fixed by #616
Labels
bug there is a bug in the way jimp behaves

Comments

@chancein007
Copy link

I tried to use the below source code to generate image that combined the template image and text together.
Jimp.read(templateImagePath, (err, image) => {
let start1=new Date().getTime();
if (err) throw err;
image.print(fontSize28, 24, 24, typeDescription)
.print(fontSize28, 24, 180, date)
.print(fontSize36, 24, 220, duration)
.resize(399,209)
.write(targetImagePath);
let start2=new Date().getTime();
console.log("++++++++Generate Image++++++",(start2-start1));
});

It seems that it will take about 1 second for each image, however, since I need to generate 10 images once so that it will take about 10 seconds. It is time-consumed.

Could you kindly give us any comments so that I can shorten the time when generating the image that combined template image and text?

Any help is much appreciated.

@chancein007
Copy link
Author

Use the gm framework can resolve this issue

@hipstersmoothie
Copy link
Collaborator

Gm is not an option for jimp. We have to run in browser and in node. so we can't use gm. as for making that faster I'm not sure how much we can. There might be some optimization we can do to the print function.

@hipstersmoothie hipstersmoothie changed the title Could you kindly give us any comments so that I can shorten the time when generating the image that combined template image and text? Optimize print function Aug 25, 2018
@hipstersmoothie hipstersmoothie added enhancement a request for a new feature or change in behavior and removed enhancement-issue labels Aug 26, 2018
@hipstersmoothie hipstersmoothie added bug there is a bug in the way jimp behaves and removed enhancement a request for a new feature or change in behavior labels Sep 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug there is a bug in the way jimp behaves
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants