No, it is not possible to use the writeProduct. Please have a look at this thread. There it was discussed how to save an image.:
Here is an example how to do it: