JPEG - revive backward compatible quality format jpeg<N> e.g jpeg80, jpeg90 etc.

ref #3024
This commit is contained in:
artemp 2015-08-11 17:13:54 +02:00
parent 6c01870397
commit b5dedd0e69

View file

@ -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 <typename T>
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())