Reputation: 53
I'm writing code that runs on Google App Engine (Java). What I'm trying to do is augment an existing image by adding text. GAE does not have any text handling in its ImagesService. Does anyone have any idea?
I'd like my code to look something like this:
...
// Read image
byte[] pageData = readImage("images/page.png");
Image pageImage = ImagesServiceFactory.makeImage(pageData);
// Add text here
...
return pageImage;
Upvotes: 5
Views: 1579
Reputation: 79
You can extend the colors on Google charts with alpha values, that way you can have a transparent png that you can overlay on top of another image using the Composite function.
http://chart.apis.google.com/chart?chs=300x50&cht=p3&chtt=hello&chts=000000FF,24&chf=bg,s,00000000
Upvotes: 0
Reputation: 14175
If you just need to overlay some simple text you could combine the Google Charts API with the Composite image function in the AppEngine Image API to get the desired result.
First construct a URL and use urlfetch from your app to grab the required text-image via the Charts API like:
URL: http://chart.apis.google.com/chart?chs=300x50&cht=p3&chtt=hello&chts=FFFFFF,24&chf=bg,s,000000 (Note the size, and colour params in this url)
Open your image with the Image API and use Composite with the image you wish to overlay text on.
Upvotes: 11