From 6045ac39647c85e04a50481b413b8cfbb90d8127 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Thu, 30 Apr 2009 21:09:18 +0000 Subject: [PATCH] allow --export-dpi to be used for setting the filter rasterization resolution in PS/EPS/PDF export --- inkscape.pod | 7 +++++-- src/main.cpp | 13 ++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/inkscape.pod b/inkscape.pod index afc364ec9..720a111b6 100644 --- a/inkscape.pod +++ b/inkscape.pod @@ -140,7 +140,9 @@ then the page color set in Inkscape in the Document Options dialog will be used =item B<-d> I, B<--export-dpi>=I The resolution used for PNG export. -The default is 90, which corresponds to 1 SVG user unit +It is also used for fallback rasterization of filtered objects +when exporting to PS, EPS, or PDF (unless you specify --export-ignore-filters to suppress +rasterization). The default is 90 dpi, which corresponds to 1 SVG user unit (px, also called "user unit") exporting to 1 bitmap pixel. This value overrides the DPI hint if used with --export-use-hints. @@ -271,7 +273,8 @@ Convert text objects to paths on export, where applicable (for PS, EPS, and PDF =item B<--export-ignore-filters> -Export filtered objects (e.g. those with blur) as vectors, ignoring the filters (for PS, EPS, and PDF export). By default, all filtered objects are rasterized, preserving the appearance. +Export filtered objects (e.g. those with blur) as vectors, ignoring the filters (for PS, EPS, and PDF export). +By default, all filtered objects are rasterized at --export-dpi (default 90 dpi), preserving the appearance. =item B<-I>, B<--query-id> diff --git a/src/main.cpp b/src/main.cpp index 05cfc8578..d6da78a97 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -291,7 +291,7 @@ struct poptOption options[] = { {"export-dpi", 'd', POPT_ARG_STRING, &sp_export_dpi, SP_ARG_EXPORT_DPI, - N_("The resolution used for exporting SVG into bitmap (default 90)"), + N_("Resolution for exporting to bitmap and for rasterization of filters in PS/EPS/PDF (default 90)"), N_("DPI")}, {"export-area", 'a', @@ -1477,6 +1477,17 @@ static void do_export_ps_pdf(SPDocument* doc, gchar const* uri, char const* mime (*i)->set_param_bool("blurToBitmap", FALSE); } else { (*i)->set_param_bool("blurToBitmap", TRUE); + + gdouble dpi = 90.0; + if (sp_export_dpi) { + dpi = atof(sp_export_dpi); + if ((dpi < 72) || (dpi > 2400.0)) { + g_warning("DPI value %s out of range [72 - 2400]. Using 90 dpi instead.", sp_export_dpi); + dpi = 90; + } + } + + (*i)->set_param_int("resolution", (int) dpi); } (*i)->save(doc, uri); -- 2.30.2