You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
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
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.
The text was updated successfully, but these errors were encountered: