#NEWLINE# def _process_jpg( self , data ) : #NEWLINE# #INDENT# offset = 2 #NEWLINE# data_length = len ( data ) #NEWLINE# end_marker = False #NEWLINE# width = 0 #NEWLINE# height = 0 #NEWLINE# x_dpi = 96 #NEWLINE# y_dpi = 96 #NEWLINE# while ( ( not end_marker ) and ( offset < data_length ) ) : #NEWLINE# #INDENT# marker = unpack ( '>H' , data [ ( offset + 0 ) : ( offset + 2 ) ] ) [ 0 ] #NEWLINE# length = unpack ( '>H' , data [ ( offset + 2 ) : ( offset + 4 ) ] ) [ 0 ] #NEWLINE# if ( ( marker == 65472 ) or ( marker == 65474 ) ) : #NEWLINE# #INDENT# height = unpack ( '>H' , data [ ( offset + 5 ) : ( offset + 7 ) ] ) [ 0 ] #NEWLINE# width = unpack ( '>H' , data [ ( offset + 7 ) : ( offset + 9 ) ] ) [ 0 ] #NEWLINE# #UNINDENT# if ( marker == 65504 ) : #NEWLINE# #INDENT# units = unpack ( 'b' , data [ ( offset + 11 ) : ( offset + 12 ) ] ) [ 0 ] #NEWLINE# x_density = unpack ( '>H' , data [ ( offset + 12 ) : ( offset + 14 ) ] ) [ 0 ] #NEWLINE# y_density = unpack ( '>H' , data [ ( offset + 14 ) : ( offset + 16 ) ] ) [ 0 ] #NEWLINE# if ( units == 1 ) : #NEWLINE# #INDENT# x_dpi = x_density #NEWLINE# y_dpi = y_density #NEWLINE# #UNINDENT# if ( units == 2 ) : #NEWLINE# #INDENT# x_dpi = ( x_density * 2.54 ) #NEWLINE# y_dpi = ( y_density * 2.54 ) #NEWLINE# #UNINDENT# if ( x_dpi == 1 ) : #NEWLINE# #INDENT# x_dpi = 96 #NEWLINE# #UNINDENT# if ( y_dpi == 1 ) : #NEWLINE# #INDENT# y_dpi = 96 #NEWLINE# #UNINDENT# #UNINDENT# if ( marker == 65498 ) : #NEWLINE# #INDENT# end_marker = True #NEWLINE# continue #NEWLINE# #UNINDENT# offset = ( ( offset + length ) + 2 ) #NEWLINE# #UNINDENT# return ( 'jpeg' , width , height , x_dpi , y_dpi )