[gimp] plug-ins: be a little more forgiving loading g3 fax images.
- From: Jacob Boerema <jboerema src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: be a little more forgiving loading g3 fax images.
- Date: Fri, 5 Mar 2021 19:14:27 +0000 (UTC)
commit fd2aa645afa409f8e3cebf460e7a75bdb0e7c645
Author: Jacob Boerema <jgboerema gmail com>
Date: Fri Mar 5 14:11:42 2021 -0500
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.
plug-ins/file-faxg3/faxg3.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/file-faxg3/faxg3.c b/plug-ins/file-faxg3/faxg3.c
index 101561d759..a44a3ca117 100644
--- a/plug-ins/file-faxg3/faxg3.c
+++ b/plug-ins/file-faxg3/faxg3.c
@@ -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);
@@ -440,7 +442,11 @@ load_image (GFile *file,
if (col == 0)
{
- cons_eol++; /* consecutive EOLs */
+ if (last_eol_row != row)
+ {
+ cons_eol++; /* consecutive EOLs */
+ last_eol_row = row;
+ }
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]