try {
// Serialize image
//TODO Eventually, this should be changed not to buffer as this increases the
//memory consumption (see PostScript output)
writeImage(image, baout);
byte[] buf = baout.toByteArray();
// Generate image
ImageObject io = afpDataStream.getImageObject(afpx, afpy, afpw,
afph, afpres, afpres);
io.setImageParameters(imageResolution, imageResolution,