Updated to produce JPGs and to allow iteration over the other fields.