added code to generate images from dict