update webp defaults to use WebPConfigInit
|
@ -620,19 +620,12 @@ void save_to_stream(T const& image,
|
|||
{
|
||||
#if defined(HAVE_WEBP)
|
||||
WebPConfig config;
|
||||
if (!WebPConfigPreset(&config, WEBP_PRESET_DEFAULT, 90))
|
||||
// Default values set here will be lossless=0 and quality=75 (as least as of webp v0.3.1)
|
||||
if (!WebPConfigInit(&config))
|
||||
{
|
||||
throw std::runtime_error("version mismatch");
|
||||
}
|
||||
/*
|
||||
WEBP_HINT_DEFAULT = 0, // default preset.
|
||||
WEBP_HINT_PICTURE, // digital picture, like portrait, inner shot
|
||||
WEBP_HINT_PHOTO, // outdoor photograph, with natural lighting
|
||||
WEBP_HINT_GRAPH, // Discrete tone image (graph, map-tile etc).
|
||||
WEBP_HINT_LAST
|
||||
*/
|
||||
config.image_hint = WEBP_HINT_GRAPH;
|
||||
config.method = 3;
|
||||
// see for more details: https://github.com/mapnik/mapnik/wiki/Image-IO#webp-output-options
|
||||
bool alpha = true;
|
||||
handle_webp_options(t,config,alpha);
|
||||
save_as_webp(stream,image,config,alpha);
|
||||
|
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 222 B |
After Width: | Height: | Size: 304 B |
After Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 222 B |
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 222 B |
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 194 B |
After Width: | Height: | Size: 474 B |
After Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 744 B |
|
@ -19,6 +19,8 @@ if mapnik.has_webp():
|
|||
|
||||
opts = [
|
||||
'webp',
|
||||
'webp:method=0',
|
||||
'webp:method=6',
|
||||
'webp:quality=64',
|
||||
'webp:alpha=false',
|
||||
'webp:partitions=3',
|
||||
|
@ -113,6 +115,7 @@ if mapnik.has_webp():
|
|||
continue
|
||||
if mapnik.Image.open(actual).tostring() != expected_bytes:
|
||||
fails.append('%s (actual) not == to %s (expected)' % (actual,expected))
|
||||
# disabled to avoid failures on ubuntu when using old webp packages
|
||||
#eq_(fails,[],'\n'+'\n'.join(fails))
|
||||
|
||||
def test_transparency_levels():
|
||||
|
@ -128,7 +131,7 @@ if mapnik.has_webp():
|
|||
for x in range(im.width()/2,im.width()):
|
||||
im.set_pixel(x,y,c3)
|
||||
|
||||
t0 = tmp_dir + 'white0.webp'
|
||||
t0 = tmp_dir + 'white0-actual.webp'
|
||||
|
||||
# octree
|
||||
format = 'webp'
|
||||
|
@ -144,6 +147,7 @@ if mapnik.has_webp():
|
|||
# this will happen if libweb is old, since it cannot open images created by more recent webp
|
||||
print 'warning, cannot open webp expected image (your libwebp is likely too old)'
|
||||
return
|
||||
# disabled to avoid failures on ubuntu when using old webp packages
|
||||
#eq_(t0_len,len(expected_bytes))
|
||||
|
||||
|
||||
|
|