使用Helma自带的Image对象进行简单的图片处理。
看不懂的参考http://adele.helma.org/download/helma/apidocs/api/index.html
app.addRepository('modules/helma/Image.js'); function main_action(){ var word=""; if(req.queryParams.w){ word=req.queryParams.w; }else{ word="CraneKing!"; } //img url var img = new Image("apps/imgx/img/nobita.jpg"); img.setColor(204, 0, 0); img.setFont("sansserif", 1, 16); img.drawString(word,28,30); //out put image var img_out=new Packages.helma.image.imageio.ImageIOGenerator(); // servlet output stream var outps=res.servletResponse.getOutputStream(); //do put image (image,stream,mimeType,品质image quality,alpha) img_out.write(img,outps,"image/jpeg",0.75,true); }