Hi,

>  > Fred, Image32 does appear to be a pretty basic type
>  > (yes it's a mapnik class). If you're using C++ at all (or have
>  > the option to) I'd highly suggest you take a look at CImg...
> 
> I'm using C++ and tend to stick what I already know (which is
> GD and ImageMagick) but will check out CImg as well.

Ok here's an update on what I've achieved so far.

I have successfully used the cairo_renderer to draw onto a cairo surface 
which I subsequently rendered onto a new surface with scaling applied. 
This gives the desired result, with good quality, but unfortunately it 
is very slow (full execution time for rendering a 2° by 2° OSM styled 
map onto an 800x600 canvas - 15 seconds with cairo compared to 7 seconds 
with AGG).

Actually applying the scaling to the cairo context used internally by 
the cairo_renderer, instead of scaling the resulting surface like I do, 
gains you a second but still the performance makes this unsuitable for 
my task.

So I went back to the idea of using the original AGG render result and 
somehow scale that bitmap before returning it. Unfortunately, neither GD 
nor ImageMagick nor CImg have a convenient method to work with the kind 
of interleaved data store that backs the Image32 type (GD stores an 
array of interleaved three-byte pixels and the alpha value is elsewhere; 
ImageMagick has 64bit pixels; CImg uses a non-interlaved four byte 
store, while Image32 is an interleaved four byte store). Somewhat 
exasperated, I did the ugliest thing and had Mapnik write the image to 
disk for me, then called ImageMagick externally to scale the PNG file, 
then read it back in - which adds an extra half second to processing but 
at least works for testing.

Since I don't need top-notch image quality for this corner case where 
the WMS client requests non-matching width/height, I will perhaps try 
the homebrew way of simply duplicating or dropping full lines in the PNG 
output to achieve the desired height. I have to roll my own PNG output 
from Image32 anyway because (unlike cairo which supports callback 
output) the existing Mapnik code will only create PNG files on disk and 
not in memory, where I need them if I want to return them to the user.

If anyone in the know reads this and has some insight to share, do speak up.

Bye
Frederik

-- 
Frederik Ramm  ##  eMail [EMAIL PROTECTED]  ##  N49°00'09" E008°23'33"
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to