plug-ins: be a little more forgiving loading g3 fax images.

Only count a broken line once and only stop after at
least 10 consecutive broken lines since older fax
images are known for having bad lines.

This enables loading the image in issues #475.
This commit is contained in:
Jacob Boerema 2021-03-05 14:11:42 -05:00
parent 1edd114834
commit fd2aa645af
1 changed files with 8 additions and 2 deletions

View File

@ -227,6 +227,7 @@ load_image (GFile *file,
int color;
int i, rr, rsize;
int cons_eol;
int last_eol_row;
GimpImage *image = NULL;
gint bperrow = MAX_COLS/8; /* bytes per bit row */
@ -263,6 +264,7 @@ load_image (GFile *file,
data = 0;
cons_eol = 0; /* consecutive EOLs read - zero yet */
last_eol_row = 0;
color = 0; /* start with white */
rr = 0;
@ -298,7 +300,7 @@ load_image (GFile *file,
bp = &bitmap[row * MAX_COLS / 8];
while (rs > 0 && cons_eol < 4) /* i.e., while (!EOF) */
while (rs > 0 && cons_eol < 10) /* i.e., while (!EOF) */
{
#ifdef DEBUG
g_printerr ("hibit=%2d, data=", hibit);
@ -439,8 +441,12 @@ load_image (GFile *file,
color = 0;
if (col == 0)
{
if (last_eol_row != row)
{
cons_eol++; /* consecutive EOLs */
last_eol_row = row;
}
}
else
{