Generating json, now need to write image