-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Add more image operations #515
Conversation
Also rewrote QR code parsing to be more readable and actually error out properly.
("borrowed" from RenderImage)
Included variants of the Roboto fonts as bitmap fonts for jimp. Changed webpack config to import the font files.
Changed SharpenImage to use the new algorithm.
self.sendStatusMessage("Adding text to image..."); | ||
|
||
const fontsMap = { | ||
"Roboto": await import(/* webpackMode: "eager" */ "../../web/static/fonts/bmfonts/Roboto72White.fnt"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use Promise.all here so we're not awaiting for each of these to load individually? Not sure whether webpack will be friends with that though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would something like this be better? Webpack seems to be happy with it.
const fontsMap = {};
const fonts = [
import(/* webpackMode: "eager" */ "../../web/static/fonts/bmfonts/Roboto72White.fnt"),
...
];
await Promise.all(fonts)
.then(fonts => {
fontsMap.Roboto = fonts[0];
...
});
const fontImages = [
import(/* webpackMode: "eager" */ "../../web/static/fonts/bmfonts/Roboto72White.png"),
...
];
await Promise.all(fontImages);
Also minor corrections to jsdocs in ImageManipulation
Change QR code ops to use ArrayBuffer. Add new function to Utils to convert a string to arraybuffer.
Now resizes the text instead of the image
Ready to merge this. We just need to fix the conflict and I'm also getting a bug in the 'Add text to image' op:
|
Fix reading QR codes with transparent backgrounds
Adds 2 more image operations (Sharpen image and Convert image format).
Sadly Jimp doesn't support outputting as GIF so we're limited to JPEG, PNG, BMP and TIFF.