Skip to content
This repository

gray fringing on raster edges #1471

springmeyer opened this Issue · 5 comments

2 participants

Dane Springmeyer Artem Pavlenko
Dane Springmeyer

Image on right is with current master (and has the problem of a single pixel gray border line). Image on right is using an older Mapnik 2.1-pre - whatever version is included in TileMill 0.9.1.

downstream report:

See also #1369

Dane Springmeyer

Looks like I can workaround by avoiding premultiplying the input raster (which also avoids darkening when using bilinear scaling). No other methods I found can workaround it.

diff --git a/src/agg/process_raster_symbolizer.cpp b/src/agg/process_raster_symbolizer.cpp
index ec4fdc9..a5acf45 100644
--- a/src/agg/process_raster_symbolizer.cpp
+++ b/src/agg/process_raster_symbolizer.cpp
@@ -93,7 +93,7 @@ void agg_renderer<T>::process(raster_symbolizer const& sym,
-            composite(current_buffer_->data(), target.data_, sym.comp_op(), sym.get_opacity(), start_x, start_y, true);
+            composite(current_buffer_->data(), target.data_, sym.comp_op(), sym.get_opacity(), start_x, start_y, false);

Dane Springmeyer springmeyer referenced this issue from a commit
Dane Springmeyer springmeyer add failing testcase for #1471 (expected image generated with patch f…
…rom #1471 that disables premultiplication of data raster before blending)
Dane Springmeyer

Just added a testcase that compares current output to what I think should be expected (or nearly) which is achievable by applying the above patch. To recap - I've also tried adding/removing ceil calls for start_* and end_* in src/agg/process_raster_symbolizer.cpp - but changing those just moves the problem gray lines around (from the left side to the right). The only thing that removes them altogether (and avoids them when using bilinear scaling (and I assume others)) is avoiding the premultiplication - which seems odd (and not the right solution) so needs a deeper look.

Artem Pavlenko artemp referenced this issue from a commit
Artem Pavlenko artemp raster scaling issue
+ fix rasterizer polygon to be equal to target image
+ align raster to pixel bouyndaries (?)
  ( fixes grey border issue - #1471)
Artem Pavlenko

@springmeyer - see 8cb2ce4 - It should fix 'grey' border issue

Artem Pavlenko

@springmeyer - another approach would be to pre-initialise target buffer with 'master' (background) buffer values.

Dane Springmeyer

8cb2ce4 looks great. Also checked tile alignment (for this test case) is good enough:

The red circle highlights one place where pixels are visibly not perfectly aligned, but only at extremely high zoom levels, so I think this is more than good enough (if this is the poorest visible alignment):

Dane Springmeyer springmeyer referenced this issue in mapbox/tilemill

mapnik 2.1.1 fixes #1683

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.