added createImage function