<br><font size=2 face="Arial">Hi James</font>
<br>
<br><font size=2 face="Arial">I think the following post contains the answer:</font>
<br><font size=2 face="Arial">http://article.gmane.org/gmane.comp.gis.mapserver.user/17904/</font>
<br>
<br><font size=2 face="Arial">The result of the getBytes-method of the
imageObj is </font>
<br><font size=2 face="Arial">javax.imageio.ImageIO.read.</font>
<br>
<br><font size=2 face="Arial">Benedikt</font>
<br>
<br><font size=2><tt>UMN MapServer Users List <MAPSERVER-USERS@LISTS.UMN.EDU>
schrieb am 10.04.2006 13:45:04:<br>
<br>
> Hi,<br>
> <br>
> I am working with java/mapscript and am trying to convert an <br>
> edu.umn.gis.mapscript.imageObj into some kind of java image object
(ideally <br>
> something that implements java.awt.image.RenderedImage – but anything
would <br>
> be a start). This is so I can manipulate the image, using JAI
and java2d, <br>
> and then stream the modified image as a SOAP message response.<br>
> <br>
> At the moment I am saving the image to a temporary file (java code
shown <br>
> below), using the imageObj.save() method, and then reloading that
image into <br>
> my java object. This is not a desirable solution for obvious
performance <br>
> and scalability reasons – especially as I seem to need to pause after
the <br>
> save to avoid the load command giving intermittent errors.<br>
> <br>
> Does anybody have any experience of converting the imageObj into a
more <br>
> useful java object? Has anyone written a java or c method to
aid this, or <br>
> found another way round a similar problem?<br>
> <br>
> Regards,<br>
> James<br>
> <br>
> ---Java code snippet---<br>
> <br>
> imageObj image = mapobj.draw(); //define imageObj<br>
> <br>
> String filename = "/var/www/html/gis/scratch/maptemp.png";<br>
> File filefilename = new File(filename); // set temp file variables<br>
> <br>
> image.save(filename, mapobj); // save image to disk<br>
> <br>
> Thread.sleep(1000); // pause to ensure has saved - avoids errors<br>
> <br>
> BufferedImage bufimg = ImageIO.read(filefilename); // load it
again<br>
</tt></font>