Closed ghost closed 10 months ago
OK, I figured it out myself, although it took me time. The issue is caused by a bug in Doxa::PNM::WriteP4
, your function that outputs the image as PBM. Line:
const int paddedWidth = image.width + 8 - (image.width % 8);
assumes that all widths have to be padded to a full byte. But in my case, the width is 1320, which is already divisible by 8, so it doesn't need any padding. This scenario has been overlooked, it seems. The correct line is:
const int paddedWidth = image.width % 8 == 0 ? image.width : image.width + 8 - (image.width % 8);
P.S. You might also want to check Doxa::PNM::Read1BitBinary
for the same bug.
Thank you! I will try to get this fixed as soon as possible.
Your solution has been implemented, with unit test coverage. Thanks again!
Hello,
I'm testing Doxa for converting color or grayscale book scans to bilevel images. I would say that 95% of time, it works, but 5% of time, Doxa produces malformed output with “zebra stripes” for lack of a better term. Here is how this output looks:
The code I’m using is very basic:
Thank you in advance for looking into this issue.
Please find attached, as ZIP file, a sample showing the problem. The ZIP file contains:
Doxa::PNM::Read
Sample.zip