Skip to content

Commit 5610738

Browse files
committed
fix #369 - pdf output with transparent background image
1 parent fc6ce62 commit 5610738

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

api/pdfrenderer.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,9 @@ bool TessPDFRenderer::imageToPDFObj(Pix *pix,
711711
int format, sad;
712712
findFileFormat(filename, &format);
713713
if (pixGetSpp(pix) == 4 && format == IFF_PNG) {
714-
pixSetSpp(pix, 3);
715-
sad = pixGenerateCIData(pix, L_FLATE_ENCODE, 0, 0, &cid);
714+
Pix *p1 = pixAlphaBlendUniform(pix, 0xffffff00);
715+
sad = pixGenerateCIData(p1, L_FLATE_ENCODE, 0, 0, &cid);
716+
pixDestroy(&p1);
716717
} else {
717718
sad = l_generateCIDataForPdf(filename, pix, kJpegQuality, &cid);
718719
}

0 commit comments

Comments
 (0)