Ejemplo n.º 1
0
void process_rgba8_jpeg(T const& image, std::string const& type, std::ostream & stream)
{
#if defined(HAVE_JPEG)
    int quality = 85;
    if (type != "jpeg")
    {
        for (auto const& kv : parse_image_options(type))
        {
            auto const& key = kv.first;
            auto const& val = kv.second;

            if ( key == "jpeg" ) continue;
            else if ( key == "quality")
            {
                if (val && ! (*val).empty())
                {
                    if (!mapnik::util::string2int(*val, quality) || quality < 0 || quality > 100)
                    {
                        throw image_writer_exception("invalid jpeg quality: '" + *val + "'");
                    }
                }
            }
        }
    }
    save_as_jpeg(stream, quality, image);
#else
    throw image_writer_exception("jpeg output is not enabled in your build of Mapnik");
#endif
}
Ejemplo n.º 2
0
void process_rgba8_jpeg(T const& image, std::string const& type, std::ostream & stream)
{
#if defined(HAVE_JPEG)
    int quality = detail::parse_jpeg_quality(type);
    save_as_jpeg(stream, quality, image);
#else
    throw image_writer_exception("jpeg output is not enabled in your build of Mapnik");
#endif
}