fixed image writing to append to original file name