summaryrefslogtreecommitdiff
path: root/source/fitz/output-pnm.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2016-06-28 18:56:01 +0200
committerTor Andersson <tor.andersson@artifex.com>2016-06-29 11:10:08 +0200
commit363f51b35f351009c1eabffeee6a410ba1f38e14 (patch)
tree7b0d9409412959ad20f001dc562980a054364b6c /source/fitz/output-pnm.c
parent4ccea9148cd19a699c102e7ccbf96837fff20f59 (diff)
downloadmupdf-363f51b35f351009c1eabffeee6a410ba1f38e14.tar.xz
Output only as many components for PAM as exist.
Diffstat (limited to 'source/fitz/output-pnm.c')
-rw-r--r--source/fitz/output-pnm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/fitz/output-pnm.c b/source/fitz/output-pnm.c
index 8310de9b..0721c08d 100644
--- a/source/fitz/output-pnm.c
+++ b/source/fitz/output-pnm.c
@@ -124,6 +124,9 @@ fz_write_pam_header(fz_context *ctx, fz_output *out, int w, int h, int n, int al
fz_printf(ctx, out, "HEIGHT %d\n", h);
fz_printf(ctx, out, "DEPTH %d\n", n);
fz_printf(ctx, out, "MAXVAL 255\n");
+
+ n -= alpha;
+
if (n == 1 && !alpha) fz_printf(ctx, out, "TUPLTYPE GRAYSCALE\n");
else if (n == 1 && alpha) fz_printf(ctx, out, "TUPLTYPE GRAYSCALE_ALPHA\n");
else if (n == 3 && !alpha) fz_printf(ctx, out, "TUPLTYPE RGB\n");
@@ -142,7 +145,6 @@ fz_write_pam_band(fz_context *ctx, fz_output *out, int w, int h, int n, int alph
if (!out)
return;
- n += alpha;
if (end > h)
end = h;
end -= band_start;