[MapProxy] Re: MapProxy Digest, Vol 23, Issue 20

Dražen Odobašić dodobas at geoinfo.geof.hr
Tue Jan 31 11:22:34 EST 2012

On 30.01.2012 03:05, DeDuikertjes wrote:
> Dejan,
> How did you use Cairo instead of PIL.
> I'm very interested.
> Marco


in the end we managed to implement alpha blending in PIL when pasting
RGBA images. You need to patch libImaging/Paste.c with Paste_RGBA.patch.
However, this has only been tested with equally sized images without
mask, so it works for MapProxy use case.

To use cairo you need to install pycairo. And, you can even install
pycairo in virutalenv if you are careful with PREFIX param when running
configure. pycairo depends on version of cairo library in your
distribution, and some really old ones, like 1.6.4, do throw Python
MemoryError exception, YMMV

Also, you need to patch image/__init__.py with MP_CAIRO.patch (works for
MapProxy 1.3.0). As this is a proof of concept, it just overwrites
existing code that handles layer merging. For instance, if you use
'opacity' layer setting, you'll need to modify it.


Dražen Odobašić, dipl.ing.surv.
Junior researcher, Department of Geoinformation Science
Faculty of Geodesy, University of Zagreb
Direct: +385 1 4639369
Mobile: +385 98 790379
e-mail/jabber: dodobas at geoinfo.geof.hr
               dodobasic at gmail.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Paste_RGBA.patch
Type: text/x-patch
Size: 963 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapproxy/attachments/20120131/1c34b7f7/Paste_RGBA.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MP_CAIRO.patch
Type: text/x-patch
Size: 1346 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapproxy/attachments/20120131/1c34b7f7/MP_CAIRO.bin

More information about the MapProxy mailing list