Java Mapscript - converting edu.umn.gis.mapscript.imageObj into a java.awt.image
Benedikt Rothe
umn-ms at HYDROTEC.DE
Mon Apr 10 08:46:13 PDT 2006
(This is a correction of a awkward omission :-)
The result of the getBytes-method of the imageObj is *compatible to the
function*
javax.imageio.ImageIO.read.
UMN MapServer Users List <MAPSERVER-USERS at LISTS.UMN.EDU> schrieb am
10.04.2006 15:06:49:
>
> Hi James
>
> I think the following post contains the answer:
> http://article.gmane.org/gmane.comp.gis.mapserver.user/17904/
>
> The result of the getBytes-method of the imageObj is
> javax.imageio.ImageIO.read.
>
> Benedikt
>
> UMN MapServer Users List <MAPSERVER-USERS at LISTS.UMN.EDU> schrieb am
10.04.2006 13:45:04:
>
> > Hi,
> >
> > I am working with java/mapscript and am trying to convert an
> > edu.umn.gis.mapscript.imageObj into some kind of java image object
(ideally
> > something that implements java.awt.image.RenderedImage ? but anything
would
> > be a start). This is so I can manipulate the image, using JAI and
java2d,
> > and then stream the modified image as a SOAP message response.
> >
> > At the moment I am saving the image to a temporary file (java code
shown
> > below), using the imageObj.save() method, and then reloading that
image into
> > my java object. This is not a desirable solution for obvious
performance
> > and scalability reasons ? especially as I seem to need to pause after
the
> > save to avoid the load command giving intermittent errors.
> >
> > Does anybody have any experience of converting the imageObj into a
more
> > useful java object? Has anyone written a java or c method to aid
this, or
> > found another way round a similar problem?
> >
> > Regards,
> > James
> >
> > ---Java code snippet---
> >
> > imageObj image = mapobj.draw(); //define imageObj
> >
> > String filename = "/var/www/html/gis/scratch/maptemp.png";
> > File filefilename = new File(filename); // set temp file variables
> >
> > image.save(filename, mapobj); // save image to disk
> >
> > Thread.sleep(1000); // pause to ensure has saved - avoids errors
> >
> > BufferedImage bufimg = ImageIO.read(filefilename); // load it again
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060410/119fe7aa/attachment.htm>
More information about the MapServer-users
mailing list