The Perl Journal March 2003
Graphics Programming in Perl, by Martien Verbruggen, is a very fun book. It's fun because Perl is fun, and it's about doing something pretty tricky in Perlmanipulating image data (for example, dynamically generating images like charts or figures as part of a CGI in response to a web request). It covers all of the graphics Perl modules significant at the time of authorship (see Verbruggen's comments on Imager below).
Graphics Programming in Perl is also fun in that it's fun to read, well-written, and well-produced. I hesitate to say what follows because I don't want to make the author or potential authors overly self-conscious, but I think it helped the book that the author's native language is not English. He doesn't blather onhe expresses things economically in the tone you'd encounter in a helpful newsgroup post.
Before tackling this book, I recommend a good familiarity with
The introductory discussion of graphics is at an intermediate level. The targeted reader either already understands the basic elements of computer graphics or is quite good at linear algebra.
The web site for the book is http://www.manning.com/verbruggen/ where you can:
I chatted online with author Martien Verbruggen from his home in Turramurra, a northern suburb of Sydney, Australia.
TPJ: Is Sydney a hi-tech mecca?
MV: Not too much. Though Australia has a very respectable technical history in early computing, as well as some brilliant minds nowadaysnames that come to mind are Andrew Tridgell and Damian Conway.You know Andrew from Samba and Rsync, and Damian is currently redesigning Perl with Larry Wall. The historical bits I am not too sharp on; after all, I am not even Australian! I've been here since September 1996. Iused to be in the Netherlands before then, which is where I was born, raised, and educated.
TPJ: What university did you attend?
MV: I went to the Eindhoven University of Technology. I did Chemical Engineering there. When I moved here, I chose a different direction.
TPJ: So your computer science interest dates from your move to Australia?
MV: Not really, I have been playing with computers since the late '70s, early '80s: Apple II, Commodore Pet, 32, 64, Amiga, etc. Then, at the university, I programmed a lot because I had a knack for it. I mainly worked in Fortran and Pascal in the early years, until I discovered C, and a little later, Perl.I was made system admin by default of the DEC Ultrix cluster of the Chem department, so my interests started shifting. I just made it permanent when I moved here. But my career "officially" started in November 1996.
TPJ: So what was your new responsibility in '96 that got you coding?
MV: I started working for the Trading Post Australia as a web programmer for this new web site that they created. I had no real qualifications, of course, except a few things that were floating around on the open-source platform. No CS degree or previous programming employment, but I got hired anyway and have been with them ever since. My responsibilities have shifted and grown a bit. I'm now development manager for two of the five business units in the company, which is now nationwide (it used to be three companies, a merger made it one). I don't really do much web stuff anymore and, unfortunately, not enough hands-on coding anymore, either. I keep fighting for less paperwork and more coding time, but the company fights back :) I still try to keep active by doing stuff at home and in my free time, and by keeping up with the newsgroups that I think are interesting.
TPJ: What is it you are developing?
MV: Trading Post publishes classified advertising periodicals. I think there are Trading Posts in the USA as well. There are differently sized Trading Posts: The Sydney one is about 200 pages weekly. The Melbourne TP was founded in 1966, and the Sydney one in 1968. My department takes care of all software in the particular business units we are responsible for. This includes the ad-taking systems (back-end, front-end, reporting), accounts receivable, billing, other reporting, outbound telemarketing. Most of this stuff runs with a Sybase RDBMS as a back-end. The main front-end is an application written in Java. There are many maintenance and reporting tools, most of which are written in Perl. We also have exporting tools for our web site, which are in C.
I guess we spend most of our time on deciding what the right design is, and implementing the correct tables and stored procedures for things, mainly SQL work and design, and higher level application and data design. And business analysis, trying to work out what the business wants, is also a very big part of my/our time.
TPJ: So what got you so hot on graphics? Your knowledge is very good!
MV: I guess it's just something that interested me. When at the university, I needed a few visualization things. My research was in mixing high-viscosity fluids, so pretty pictures were important. I also had some colleagues who did research on particles in suspension and needed pictures, so I started looking at how things could be drawn with computers, and dabbled with PostScript, various libraries, various terminals, and output devices, and slowly gathered information. In early '94, I installed an early release of the NCSA web server, and fiddled with a bundle of tools for that. One of them, about a year or so later, was a log parser; and later, some tools to make pretty pictures from the log file. That tool used gnuplot early on, which had limitations, so I wrote some Perl stuff to generate charts, and that survived as GD::Graph.
When Manning contacted me a few years ago to see whether I'd be interested to write about graphics in Perl, I didn't actually think there'd be enough to write about, or that I knew enough about it. I promised to look into it a bit and actually found out that there was more than enough material, and that what I didn't know, I could learn about. So I started writing, and I probably learned as much about graphics while writing as I already knew! The largest job was determining what to put in, and in which order. The actual assimilation of knowledge wasn't that hard :)
TPJ: Why did Manning contact you?
MV: They asked some of the authors they already knew to see whether anyone could come up with a name of someone who might be able to write a book about Perl and graphics. Because of GD::Graph and my participation on the comp.lang.perl.* newsgroups, my name popped into someone's head and was passed on to Manning.
TPJ: Your book interested me especially because, at the time I received it for review, I was working on a book about playing concertina. It has many diagrams that really are the same diagram with minor changes. So I was filled with angst as I tried to decide whether to go on making the diagrams by hand or delve into generating them algorithmically!
MV: I'd probably do them programmatically. I once helped someone write a tab/chord formatter and we coded the chord pictures as well, instead of storing them. The PostScript generated would actually draw them. This is one of the places where programming comes in handy: many pictures, all subtly, but determinedly different. But, did the book answer your question and/or help you out?
TPJ: Yes, it answered my question, enough so I could do the cost/benefits analysis and conclude that, for the given instance, it was more work to program than to do them by hand!
MV: I tend to find that when I do this sort of thing, I can often use the scaffolding of the programs in other projects. But I don't play an instrument, not really, so I suspect that for me, programming is still the most fun I can have on my own. However, I do make the point in the first chapter that certain things are still better done by sitting down at a terminal and interactively creating the pictures you need.
TPJ: I found your discussion of graphic file formats quite good. You really did spend a lot of time examining these things.
MV: Well, that particular one is a bit of a pet peeve of mine. I dislike it when people use inappropriate file formats. But of course, I don't think that I spent enough time on that section. There is still much more to say on it! There are other areas the book needs more work on, in retrospect. My biggest regret is not taking the time to add Imager to it. When I wrote the original material, Imager was very immature. However, it has turned out to be a very good and usable module. It has many capabilities that Image::Magick has, and many that GD has, and it certainly deserves a place between them. If I had more time, I'd write addenda to the book to be put on the web site.
TPJ: Are you going to write any more books?
MV: If anything, writing a book is much more work than I thought it would be. Maybe I'll become independently rich soon. If that happens, I'll be writing again.
TPJ