mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-27 12:49:35 +08:00
Fix grey result of indexed PNG in pdfrenderer.
This commit is contained in:
parent
a7f860a417
commit
209cf5c476
@ -664,6 +664,8 @@ bool TessPDFRenderer::BeginDocumentHandler() {
|
||||
bool TessPDFRenderer::imageToPDFObj(Pix *pix, const char *filename, long int objnum,
|
||||
char **pdf_object, long int *pdf_object_size,
|
||||
const int jpg_quality) {
|
||||
int sad;
|
||||
|
||||
if (!pdf_object_size || !pdf_object) {
|
||||
return false;
|
||||
}
|
||||
@ -674,14 +676,7 @@ bool TessPDFRenderer::imageToPDFObj(Pix *pix, const char *filename, long int obj
|
||||
}
|
||||
|
||||
L_Compressed_Data *cid = nullptr;
|
||||
|
||||
int sad = 0;
|
||||
if (pixGetInputFormat(pix) == IFF_PNG) {
|
||||
sad = pixGenerateCIData(pix, L_FLATE_ENCODE, 0, 0, &cid);
|
||||
}
|
||||
if (!cid) {
|
||||
sad = l_generateCIDataForPdf(filename, pix, jpg_quality, &cid);
|
||||
}
|
||||
sad = l_generateCIDataForPdf(filename, pix, jpg_quality, &cid);
|
||||
|
||||
if (sad || !cid) {
|
||||
l_CIDataDestroy(&cid);
|
||||
|
Loading…
Reference in New Issue
Block a user