use recursion to traverse the jpeg markers