added image resizing and format conversion