Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merge 2 images using google app engine and python?

I want to merge 2 images and that too at specific location of 1st image.

Example: 1st image: x.png (400 X 400px) 2nd image: y.png (at 100,100 co-ordinates)

How can i do this using python in google appengine.?

If you can provide some codes for this ... or any reference to this code... will be appreciated.

Thank you, Please let me know for more clarification.

like image 917
Love Sharma Avatar asked Apr 08 '11 11:04

Love Sharma


2 Answers

This can be done using the very cut down imaging library which emulates some of the functions of PIL. The function you need is composite

from google.appengine.api import images

xpng = #Load data from x.png here, or read from BlobProperty
ypng = #Load data from y.png here, or read from BlobProperty

composite = images.composite([(xpng, 0, 0, 1.0, images.TOP_LEFT),
    (ypng, 100, 100, 1.0, images.TOP_LEFT)], 400, 400)

#composite now holds your new image data, to do what you want with
like image 52
Steve Mayne Avatar answered Oct 01 '22 05:10

Steve Mayne


Try composite method : see the documentation

like image 45
user691287 Avatar answered Oct 01 '22 04:10

user691287