From fd26a220c69e0942e12c2f3a21b7193225f74a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zdenko=20Podobn=C3=BD?= Date: Fri, 5 Aug 2016 22:37:58 +0200 Subject: [PATCH] fix #369 - pdf output with transparent background image --- api/pdfrenderer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/pdfrenderer.cpp b/api/pdfrenderer.cpp index 3b969fe7e8..4708300492 100644 --- a/api/pdfrenderer.cpp +++ b/api/pdfrenderer.cpp @@ -711,8 +711,9 @@ bool TessPDFRenderer::imageToPDFObj(Pix *pix, int format, sad; findFileFormat(filename, &format); if (pixGetSpp(pix) == 4 && format == IFF_PNG) { - pixSetSpp(pix, 3); - sad = pixGenerateCIData(pix, L_FLATE_ENCODE, 0, 0, &cid); + Pix *p1 = pixAlphaBlendUniform(pix, 0xffffff00); + sad = pixGenerateCIData(p1, L_FLATE_ENCODE, 0, 0, &cid); + pixDestroy(&p1); } else { sad = l_generateCIDataForPdf(filename, pix, kJpegQuality, &cid); }