count_frames function

Count the number of frames in a TIFF file.