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