Re: [OpenMap Users] Image Server

From: Don Dietrick <dietrick_at_bbn.com>
Date: Fri, 28 Sep 2007 18:15:39 -0400

Hi Jay,

Sorry for the delay in getting back to you, are you still looking for
an answer for this? You have to create an image that formats in the
image in a format that handles transparency (gif, png), so your image
formatter choice matters.

Are you just looking to create a Java Image? You can just create a
BufferedImage with an ARGB image type, then walk through your layers
calling renderDataForProjection(Graphics, projection), with the
Graphics from the BufferedImage and the projection you want. This
would save you from the image encoding that is being performed in
your example, if you just want the image.

Hope this helps,

Don


On Sep 18, 2007, at 11:21 AM, Jay D. Askren wrote:

> I'm using the Image Server to generate images and it appears to work
> pretty well. What I haven't been able to figure out is how create an
> image with a transparent background. How do I go about doing
> that? If
> I set the background to be transparent, An image is created that has a
> black background.
>
> Here's the code I use to create the image:
>
> _server = new ImageServer(_handler.getProperties());
> _server.setBackground(new Color(153, 179, 204, 0));
> _currentProjection.setCenter(centerLat, centerLon);
> _currentProjection.setScale(scale);
> byte[] imageData = _server.createImage(_currentProjection, _width,
> _height, getVisibleLayers());
> BufferedImage image = null;
> try {
> image = ImageIO.read(ImageIO.createImageInputStream(new
> ByteArrayInputStream(imageData)));
> } catch (IOException e) {
> e.printStackTrace();
> }
>
>
> Is there a way to make it transparent? Thanks.
>
>
> Jay
>
>
> --
> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
> with the following text in the BODY of the message "unsubscribe
> openmap-users"]

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick_at_bbn.com
BBN Technologies, Cambridge MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Fri Sep 28 2007 - 18:15:55 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:08 EDT