-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -611,6 +611,13 @@ void TessBaseAPI::SetSourceResolution(int ppi) { | |
*/ | ||
void TessBaseAPI::SetImage(Pix* pix) { | ||
if (InternalSetImage()) { | ||
if (pixGetSpp(pix) == 4 && pixGetInputFormat(pix) == IFF_PNG) { | ||
// remove alpha channel from png | ||
PIX* p1 = pixRemoveAlpha(pix); | ||
pixSetSpp(p1, 3); | ||
pix = pixCopy(nullptr, p1); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
zdenop
Author
Contributor
|
||
pixDestroy(&p1); | ||
} | ||
thresholder_->SetImage(pix); | ||
SetInputImage(thresholder_->GetPixRect()); | ||
} | ||
|
pix = pixCopy(nullptr, p1);
Is unneeded here.pixDestroy(&p1);
will handle fine.