Again: imgObj2java.awt.image
Benedikt Rothe
umn-ms at HYDROTEC.DE
Sun Feb 19 23:54:41 PST 2006
Hi Oliver
Do you mean this?
package de.hydrotec.test.WebMapGUITest;
import java.io.ByteArrayInputStream;
import java.io.FileOutputStream;
import javax.imageio.ImageIO;
import edu.umn.gis.mapscript.mapObj;
public class WorkWithImageTest {
public static void main(String args[]) throws java.io.IOException {
System.loadLibrary("mapscript");
mapObj map = new mapObj("test.map");
edu.umn.gis.mapscript.imageObj ms_img = map.drawQuery();
// Output in Mapserver-style
ms_img.save("ms.png",map);
java.io.InputStream is = new
ByteArrayInputStream(ms_img.getBytes());
java.awt.image.BufferedImage java_img = ImageIO.read(is);
// Output in Java-Style
ImageIO.write(java_img,"png",new FileOutputStream("java.png"));
}
}
Benedikt
PS: Using Mapserver for a desktop-app sounds intersting.I'm curious to
know
which advantages over JUMP/uDig (or something like this) you
see/hope/expect?
UMN MapServer Users List <MAPSERVER-USERS at LISTS.UMN.EDU> schrieb am
17.02.2006 17:56:32:
> Hi Fernando and thank you very much for your answer,
>
> I need that for an abstraction layer on mapserver to develop desktop
> applications. Do you know what imageObj.getByte() returns? There is a
lack of
> documentation for JavaMapserver-API, yet, isn't it?
>
> Best regards,
> Oliver
>
>
> Am Freitag, 17. Februar 2006 17:31 schrieb Fernando Simon:
> > Hi Oliver,
> > I already used JavaMapscript but never needed to convert the
> > imageobj to awt.image.
> > I don't believe that it's possible to do directly, so the best way
> > is save the image and after use the awt.image.
> > Best regards.
> >
> >
------------------------------------------------------------------------
> > Fernando Simon
> > Mapserver and Oracle Spatial developer
> > G10 - Laboratorio de Computacao Aplicada - Brazil
> > http://www.univali.br/g10 - UNIVALI/CTTMAR
> >
------------------------------------------------------------------------
> >
> > Oliver Lichte (by way of Oliver Lichte <lichte at icbm.de>) wrote:
> > > Hello.
> > >
> > > Was this question too trivial or too difficult??? Unfortunately,
no-one
> > > answered untit now, so I'll try it again:
> > >
> > > I'd like to convert imageObj to java.awt.image. Is it possible to
get
> > > direct pixel access via Java mapserver-API or do I have always to
create
> > > a temporary file to share the image?
> > >
> > > What is the content of the byte-array returned by method getByte()?
> > >
> > > Regards,
> > > Oliver
>
> --
> Junior Research Group IMPULSE
> ICBM * Carl-v.-Ossietzky University of Oldenburg
> PO-Box 2503 * 26111 Oldenburg - Germany - http://www.icbm.de/impulse
> room: W15-2-239 * fon:+49-441-798-3622 * fax:+49-441-798-3404
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060220/a4f8e493/attachment.htm>
More information about the MapServer-users
mailing list