added an image export function