diff --git a/src/image_util_jpeg.cpp b/src/image_util_jpeg.cpp index 22d6ed480..22cd3539d 100644 --- a/src/image_util_jpeg.cpp +++ b/src/image_util_jpeg.cpp @@ -38,8 +38,8 @@ namespace mapnik { -jpeg_saver::jpeg_saver(std::ostream & stream, std::string const& t): - stream_(stream), t_(t) {} +jpeg_saver::jpeg_saver(std::ostream & stream, std::string const& t) + : stream_(stream), t_(t) {} template void process_rgba8_jpeg(T const& image, std::string const& type, std::ostream & stream) @@ -54,6 +54,13 @@ void process_rgba8_jpeg(T const& image, std::string const& type, std::ostream & auto const& val = kv.second; if ( key == "jpeg" ) continue; + else if ( key.size() > 4 && key.substr(0,4) == "jpeg") + { + if (!mapnik::util::string2int(key.substr(4), quality)) + { + throw image_writer_exception("invalid jpeg quality: '" + key.substr(4) + "'"); + } + } else if ( key == "quality") { if (val && ! (*val).empty())