diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-03-16 18:03:49 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-03-16 18:06:51 +0000 |
commit | d8b0666bd1ca7e2678dd28da8154484c65623b65 (patch) | |
tree | a86691f571dc269ca7479143d33750767182c1eb /source/tools | |
parent | 58007a25a03b5aa3cb5242c3a23a81cefb59d23f (diff) | |
download | mupdf-d8b0666bd1ca7e2678dd28da8154484c65623b65.tar.xz |
mutool draw: Add banded mode output for pbm files.
Diffstat (limited to 'source/tools')
-rw-r--r-- | source/tools/mudraw.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c index 54363f03..461f574b 100644 --- a/source/tools/mudraw.c +++ b/source/tools/mudraw.c @@ -631,6 +631,8 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) fz_write_pam_header(ctx, out, pix->w, totalheight, pix->n, savealpha); else if (output_format == OUT_PNG) poc = fz_write_png_header(ctx, out, pix->w, totalheight, pix->n, savealpha); + else if (output_format == OUT_PBM) + fz_write_pbm_header(ctx, out, pix->w, totalheight); } for (band = 0; band < bands; band++) @@ -684,8 +686,8 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) fz_write_pixmap_as_pcl(ctx, out, pix, &options); } else if (output_format == OUT_PBM) { - fz_bitmap *bit = fz_new_bitmap_from_pixmap(ctx, pix, NULL); - fz_write_bitmap_as_pbm(ctx, out, bit); + fz_bitmap *bit = fz_new_bitmap_from_pixmap_band(ctx, pix, NULL, band, bandheight); + fz_write_pbm_band(ctx, out, bit); fz_drop_bitmap(ctx, bit); } else if (output_format == OUT_TGA) @@ -1009,9 +1011,9 @@ int mudraw_main(int argc, char **argv) if (bandheight) { - if (output_format != OUT_PAM && output_format != OUT_PGM && output_format != OUT_PPM && output_format != OUT_PNM && output_format != OUT_PNG) + if (output_format != OUT_PAM && output_format != OUT_PGM && output_format != OUT_PPM && output_format != OUT_PNM && output_format != OUT_PNG && output_format != OUT_PBM) { - fprintf(stderr, "Banded operation only possible with PAM, PGM, PPM, PNM and PNG outputs\n"); + fprintf(stderr, "Banded operation only possible with PAM, PBM, PGM, PPM, PNM and PNG outputs\n"); exit(1); } if (showmd5) |