Skip to content

Commit

Permalink
fix issue #1889
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenop committed Sep 13, 2018
1 parent aa47a84 commit 59e42fc
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/api/pdfrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,12 +715,15 @@ bool TessPDFRenderer::imageToPDFObj(Pix *pix,
const int kJpegQuality = 85;

int format, sad;
findFileFormat(filename, &format);
if (pixGetSpp(pix) == 4 && format == IFF_PNG) {
Pix *p1 = pixAlphaBlendUniform(pix, 0xffffff00);
sad = pixGenerateCIData(p1, L_FLATE_ENCODE, 0, 0, &cid);
pixDestroy(&p1);
} else {
if (filename) {
findFileFormat(filename, &format);
if (pixGetSpp(pix) == 4 && format == IFF_PNG) {
Pix *p1 = pixAlphaBlendUniform(pix, 0xffffff00);
sad = pixGenerateCIData(p1, L_FLATE_ENCODE, 0, 0, &cid);
pixDestroy(&p1);
}
}
if (!cid) {
sad = l_generateCIDataForPdf(filename, pix, kJpegQuality, &cid);
}

Expand Down

0 comments on commit 59e42fc

Please sign in to comment.