JPEG - revive backward compatible quality format jpeg<N> e.g jpeg80, jpeg90 etc.
ref #3024
This commit is contained in:
parent
6c01870397
commit
b5dedd0e69
1 changed files with 9 additions and 2 deletions
|
@ -38,8 +38,8 @@
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
|
|
||||||
jpeg_saver::jpeg_saver(std::ostream & stream, std::string const& t):
|
jpeg_saver::jpeg_saver(std::ostream & stream, std::string const& t)
|
||||||
stream_(stream), t_(t) {}
|
: stream_(stream), t_(t) {}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void process_rgba8_jpeg(T const& image, std::string const& type, std::ostream & stream)
|
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;
|
auto const& val = kv.second;
|
||||||
|
|
||||||
if ( key == "jpeg" ) continue;
|
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")
|
else if ( key == "quality")
|
||||||
{
|
{
|
||||||
if (val && ! (*val).empty())
|
if (val && ! (*val).empty())
|
||||||
|
|
Loading…
Reference in a new issue