created picture capture function