Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
PNG alpha channel is converted to white instead of default ugly black
azivnerd9f2bb37e7e0
diff --git a/routes/api/image.js b/routes/api/image.jsindex 80616491f2..c51bacd18c 100644--- a/routes/api/image.js+++ b/routes/api/image.js@@ -107,6 +107,9 @@ async function resize(buffer) {// we do resizing with max quality which will be trimmed during optimization step nextimage.quality(100);+ // when converting PNG to JPG we lose alpha channel, this is replaced by white to match Trilium white background+ image.background(0xFFFFFFFF);+// getBuffer doesn't support promises so this workaroundreturn await new Promise((resolve, reject) => image.getBuffer(jimp.MIME_JPEG, (err, data) => {if (err) {