summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/mutool/run.html17
-rw-r--r--include/mupdf/fitz/device.h3
-rw-r--r--source/fitz/draw-device.c21
3 files changed, 31 insertions, 10 deletions
diff --git a/docs/mutool/run.html b/docs/mutool/run.html
index 48c47d81..71690708 100644
--- a/docs/mutool/run.html
+++ b/docs/mutool/run.html
@@ -495,13 +495,24 @@ The argument must be the same device object that was returned by the beginPage m
</dl>
<p>
-The current output formats supported are CBZ and PDF.
+The current output formats supported are CBZ, PNG and PDF.
<p>
-The CBZ output options are:
+The image format (CBZ, PNG, etc) output options are:
<dl>
-<dt>resolution=N
+<dt>rotate=N
+<dd>Rotate rendered pages N degrees counterclockwise.
+<dt>resolution=N, x-resolution=N, y-resolution=N
<dd>Render each page to an image at N pixels per inch.
+<dt>width=N
+<dd>Render pages to fit N pixels wide (ignore resolution option).
+<dt>height=N
+<dd>Render pages to fit N pixels tall (ignore resolution option).
+<dt>colorspace=(gray|rgb|cmyk)
+<dd>Render using specified colorspace.
+<dt>alpha
+<dd>Render pages with alpha channel and transparent background.
+
</dl>
<p id="pdf-write-options">
diff --git a/include/mupdf/fitz/device.h b/include/mupdf/fitz/device.h
index 99588075..172081fe 100644
--- a/include/mupdf/fitz/device.h
+++ b/include/mupdf/fitz/device.h
@@ -369,7 +369,8 @@ typedef struct fz_draw_options_s fz_draw_options;
struct fz_draw_options_s
{
int rotate;
- int resolution;
+ int x_resolution;
+ int y_resolution;
int width;
int height;
fz_colorspace *colorspace;
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c
index 44d0bfaf..5d7088a6 100644
--- a/source/fitz/draw-device.c
+++ b/source/fitz/draw-device.c
@@ -4,7 +4,9 @@
const char *fz_draw_options_usage =
"Common raster format output options:\n"
"\trotate=N: rotate rendered pages N degrees counterclockwise\n"
- "\tresolution=N: resolution of rendered pages in pixels per inch\n"
+ "\tresolution=N: set both X and Y resolution of rendered pages in pixels per inch\n"
+ "\tx-resolution=N: X resolution of rendered pages in pixels per inch\n"
+ "\ty-resolution=N: Y resolution of rendered pages in pixels per inch\n"
"\twidth=N: render pages to fit N pixels wide (ignore resolution option)\n"
"\theight=N: render pages to fit N pixels tall (ignore resolution option)\n"
"\tcolorspace=(gray|rgb|cmyk): render using specified colorspace\n"
@@ -24,7 +26,8 @@ fz_parse_draw_options(fz_context *ctx, fz_draw_options *opts, const char *args)
memset(opts, 0, sizeof *opts);
- opts->resolution = 96;
+ opts->x_resolution = 96;
+ opts->y_resolution = 96;
opts->rotate = 0;
opts->width = 0;
opts->height = 0;
@@ -34,7 +37,11 @@ fz_parse_draw_options(fz_context *ctx, fz_draw_options *opts, const char *args)
if (fz_has_option(ctx, args, "rotate", &val))
opts->rotate = fz_atoi(val);
if (fz_has_option(ctx, args, "resolution", &val))
- opts->resolution = fz_atoi(val);
+ opts->x_resolution = opts->y_resolution = fz_atoi(val);
+ if (fz_has_option(ctx, args, "x-resolution", &val))
+ opts->x_resolution = fz_atoi(val);
+ if (fz_has_option(ctx, args, "y-resolution", &val))
+ opts->y_resolution = fz_atoi(val);
if (fz_has_option(ctx, args, "width", &val))
opts->width = fz_atoi(val);
if (fz_has_option(ctx, args, "height", &val))
@@ -54,7 +61,8 @@ fz_parse_draw_options(fz_context *ctx, fz_draw_options *opts, const char *args)
opts->alpha = opteq(val, "yes");
/* Sanity check values */
- if (opts->resolution <= 0) opts->resolution = 96;
+ if (opts->x_resolution <= 0) opts->x_resolution = 96;
+ if (opts->y_resolution <= 0) opts->y_resolution = 96;
if (opts->width < 0) opts->width = 0;
if (opts->height < 0) opts->height = 0;
@@ -64,7 +72,8 @@ fz_parse_draw_options(fz_context *ctx, fz_draw_options *opts, const char *args)
fz_device *
fz_new_draw_device_with_options(fz_context *ctx, const fz_draw_options *opts, const fz_rect *mediabox, fz_pixmap **pixmap)
{
- float zoom = opts->resolution / 72.0f;
+ float x_zoom = opts->x_resolution / 72.0f;
+ float y_zoom = opts->y_resolution / 72.0f;
int w = opts->width;
int h = opts->height;
fz_rect bounds;
@@ -72,7 +81,7 @@ fz_new_draw_device_with_options(fz_context *ctx, const fz_draw_options *opts, co
fz_matrix transform;
fz_device *dev;
- fz_pre_scale(fz_rotate(&transform, opts->rotate), zoom, zoom);
+ fz_pre_scale(fz_rotate(&transform, opts->rotate), x_zoom, y_zoom);
bounds = *mediabox;
fz_round_rect(&ibounds, fz_transform_rect(&bounds, &transform));