parameters: (data)
return_statement: return w, h
docstring: read the (width, height) from a JPEG header
docstring_summary: read the (width, height) from a JPEG header
docstring_tokens: read the ( width height ) from a JPEG header
function: def _jpegxy(data):
      """read the (width, height) from a JPEG header"""
      # adapted from http://www.64lines.com/jpeg-width-height
  
      idx = 4
      while True:
          block_size = struct.unpack('>H', data[idx:idx+2])[0]
          idx = idx + block_size
          if data[idx:idx+2] == b'\xFF\xC0':
              # found Start of Frame
              iSOF = idx
              break
          else:
              # read another block
              idx += 2
  
      h, w = struct.unpack('>HH', data[iSOF+5:iSOF+9])
      return w, h
function_tokens: def _jpegxy ( data ) : # adapted from http://www.64lines.com/jpeg-width-height idx = 4 while True : block_size = struct . unpack ( '>H' , data [ idx : idx + 2 ] ) [ 0 ] idx = idx + block_size if data [ idx : idx + 2 ] == b'\xFF\xC0' : # found Start of Frame iSOF = idx break else : # read another block idx += 2 h , w = struct . unpack ( '>HH' , data [ iSOF + 5 : iSOF + 9 ] ) return w , h