[OSM-dev] PNG type for Mapnik map

Stefan Agner falstaff at deheime.ch
Tue May 27 16:58:54 BST 2008


Hello,

I found this E-Mail OSM-dev history:
 > > I tried it out and the png256 stuff in Mapnik doesn't do the right
 > > thing. You'll end up with tiles not fitting together because the
 > > colors
 > > as slightly off. The change is large enough to see in some places.
 > >
 >
 > Yes, I had the same experience. Not very often, but there'll be some
 > tiles that don't match (background colour usually)
 >
 > > Imagemagick convert seems to better with this. The algorithm it
 > > uses is
 > > described on http://www.imagemagick.org/script/quantize.php . But I
 > > could imagine that there are pathological cases where it also breaks.
 > >
 >
 > Yes, as with any quantization. AFAIK ImageMagick is using some kind
 > of octree algorithms and so is Mapnik.
 > Thanks for the link and I'll check it out.
 >
 > > I haven't looked into the algorithm that Mapnik uses, but maybe it can
 > > be improved by making sure that all colors mentioned in the Map file,
 > > i.e. all colors that we explicitly asked for, are retained. That way
 > > only the "artificial" colors created by the antialiasing will be
 > > changed.
 > > This should make sure that tiles will always fit together because all
 > > the larger colored areas will use the same colors.
 >
 > The above is pretty much what I'm thinking of trying. We can collect
 > colours distribution from *.xml file.
 > It would easy for solid strokes and fills and not so easy for image
 > based symbols, which might have thousands of colours.
 > I guess we can quickly quantize them as well. Also, we can just have
 > a predefined set of colours, might work even better. There is
 > probably some kind of cartographic rule - good map should have no
 > more then 24 different prime colours or something.
 >
 > Another thing I'd like to investigate is using different colour
 > spaces. I had more correct (visually on macbook) palette while
 > quantizing in YCbBr.
 >
 > Anyways, could you send me those tiles, where colours don't much,
 > please ? With original RGBA versions if possible.
 >
 > Cheers
 > Artem

Im using now Mapnik 0.5.1 and trying to work without Imagemagick. I 
still have this different colours described above. The difference is 
very small, but its not just different between Imagemagick/Mapnik, with 
Mapnik there are also differences between area with roads and emtpy areas...

I found nothing on Mapnik Trac about this. Is there a solution on the 
way? I've here some tiles made with Imagemagick and the same tile made 
with Mapnik itself, if needed...

Bye
falstaff

-- 
cya
stefan

deheime.ch
Bifangstrasse 20
6048 Horw

Tel. +41 41 340 08 56

falstaff at deheime.ch
http://www.deheime.ch/




More information about the dev mailing list