I'm trying to create a composite image, but it seems like it is
ignoring any alpha channels and transparency. I looked through the
forums, some people say their is a bug in the dev sdk, so I tried it on
google server too, similar results.

I've uploading the images and results in this post. The code basically
uses the bg.png (the white is transparent) as background and overlays
test.png (the white is transparent) over it, the results from the local
dev server (local.png) is wrong, uploading the app to google app
engine, the result is different, but is also wrong (remote.png). Is
this a bug or is there something wrong with my code below?

[code]

public class CreateImageServlet extends HttpServlet {

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
doOutput(req, resp);
}

private void doOutput(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
ImagesService service = ImagesServiceFactory.getImagesService();

Image bg = ImagesServiceFactory.makeImage(getImage("bg.png"));
Image over = ImagesServiceFactory.makeImage(getImage("test.png"));

List<Composite> composites = new ArrayList<Composite>();
composites.add(ImagesServiceFactory.makeComposite(bg, 0, 0, 1,
Anchor.TOP_LEFT));
composites.add(ImagesServiceFactory.makeComposite(over, 0, 0, 1,
Anchor.TOP_LEFT));
Image image = service.composite(composites, bg.getWidth(),
bg.getHeight(), 0, OutputEncoding.PNG);

resp.setContentType("image/png");
resp.getOutputStream().write(image.getImageData());
}


private byte[] getImage(String resource) throws IOException {
InputStream is = getClass().getResourceAsStream(resource);
try {
ByteArrayOutputStream os = new ByteArrayOutputStream(1024*6);
byte[] buf = new byte[1024];
int read;

while ( (read=is.read(buf)) != -1 ) {
os.write(buf, 0, read);
}

return os.toByteArray();
} finally {
is.close();
}
}

}

[/code]

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

<<attachment: bg.png>>

<<attachment: test.png>>

<<attachment: local.png>>

<<attachment: remote.png>>

Reply via email to