[CUWiN] web graphics: anything better than gd?

stephane at shimaore.net stephane at shimaore.net
Wed Dec 8 21:42:21 CST 2004


Dave,

> Does anybody know of equivalents to the gd library that are preferably
> more memory-efficient (maybe they render to streams instead of gigantic
> buffers) and with better diagnostics (you wouldn't think the gd authors
> knew that fwrite(3) could fail)?

If you want something that outputs bitmaps, you need to render the 
bitmaps from a vectoriel/functional description (an API, a vectorial 
format like SVG) into a bitmapped format. You'll always need memory for 
that unless you render by parts (which I guess you can implement using 
GD too). You can then use tools like the ones in the netpbm suite to 
merge the pieces together, or simply (in the case of a web application) 
let the web browser merge the pieces visually (that's what I had done 
when I wrote the web page with my wardriving info; the map was covering 
all of C-U at 1m resolution, but 200x200 pixels at a time).
As for (f)writing issues, I don't know -- in the Perl GD scripts I've 
done in the past, I generally do a "print $img->png()" at the end and 
don't worry much after that because it ends up on a webbrowser ("reload 
if it's broken"), but I've no idea what's the size of the thing you're 
trying to generate nor where it ends up. :)

Obviously, if the app is mostly vectorial (no background bitmap for 
example), you could output as SVG and then use Apache's Batik to render 
to bitmap, but that's just displacing the problem one step.
You could also output SVG and send it to a browser (still, I'm assuming 
you're looking at some kind of web application), but you'd probably 
want to make sure you can recommend a decent SVG viewer for all major 
platforms before doing that. (My personal experience is that it was 
tough, but I haven't looked at that for over a year now.)

HTH,
S.



More information about the CU-Wireless mailing list