<br><font size=2><tt>(This is a correction of a awkward omission :-)</tt></font>
<br>
<br><font size=2><tt>The result of the getBytes-method of the imageObj
is *compatible to the function*<br>
javax.imageio.ImageIO.read. </tt></font>
<br>
<br><font size=2><tt>UMN MapServer Users List <MAPSERVER-USERS@LISTS.UMN.EDU>
schrieb am 10.04.2006 15:06:49:<br>
<br>
> <br>
> Hi James <br>
> <br>
> I think the following post contains the answer: <br>
> http://article.gmane.org/gmane.comp.gis.mapserver.user/17904/ <br>
> <br>
> The result of the getBytes-method of the imageObj is <br>
> javax.imageio.ImageIO.read. <br>
> <br>
> Benedikt <br>
> <br>
> 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</tt></font>