you return the image from the render method. This will be echoed, so basically __toString will be called: https://github.com/owncloud/core/blob/master/lib/private/image.php#L268