Skip to content

Commit f794571

Browse files
committed
use pdf L_FLATE_ENCODE only for png input; fixes #1961
1 parent 5cf5c80 commit f794571

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/api/pdfrenderer.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,8 @@ bool TessPDFRenderer::imageToPDFObj(Pix *pix,
716716
const int kJpegQuality = jpg_quality;
717717

718718
int format, sad;
719-
sad = pixGenerateCIData(pix, L_FLATE_ENCODE, 0, 0, &cid);
719+
if (pixGetInputFormat(pix) == IFF_PNG)
720+
sad = pixGenerateCIData(pix, L_FLATE_ENCODE, 0, 0, &cid);
720721
if (!cid) {
721722
sad = l_generateCIDataForPdf(filename, pix, kJpegQuality, &cid);
722723
}

0 commit comments

Comments
 (0)