I am not quite sure how to do quite what I am looking for.

I am trying to use mapnik rendered images in an existing C++ code base.  
I have written everything to generate the image and save it to a file:
    // Ouptut the image
    mapnik::Image32 buf(map.getWidth(), map.getHeight());
    mapnik::agg_renderer<mapnik::Image32> ren(map, buf);
    ren.apply();
    mapnik::save_to_file<mapnik::ImageData32>(buf.data(), 
fileName.c_str(), "jpeg");

Which creates my image as a file (and it looks great BTW.  I am 
extremely pleased with the library's abilities!).

What I need, however, is to get this into a jpeg or png image pointer.  
I also need to be able to get the RGB values from each pixel (which I 
know how to do if I use GD).

Looking at the viewer program in the demo directory of the mapnik 
source, I see using the raw data to create a QImage
QImage image((uchar*)buf.raw_data(),width,height,QImage::Format_ARGB32);

Based on this, I assume the Image32 data is pixel by pixel where the 
unsigned value represents the RGB value.  Does anyone know how to take 
this and create an GD image?  I don't think there is a GD constructor to 
build from and unsigned array (or am I missing it?).

I know I can write the image to a file (using mapnik's save_to_file) and 
read it back in using GD, but I would rather not have to use temporary 
files.

I have never really used Qt for anything and I do have GD code scattered 
though out my existing code base, so my preference would be to use GD 
rather than Qt, but if there is an easy way to get a jpg, png, and RGB 
values from the QImage, I will go that way.

Any pointers or ideas would be great.  Thanks in advance.

- Brian

_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to