def _process_image(filename, coder):
 with tf.gfile.FastGFile(filename, 'r') as f:
  image_data = f.read()
 if _is_png(filename):
  print(('Converting PNG to JPEG for %s' % filename))
  image_data = coder.png_to_jpeg(image_data)
 image = coder.decode_jpeg(image_data)
 assert (len(image.shape) == 3)
 height = image.shape[0]
 width = image.shape[1]
 assert (image.shape[2] == 3)
 return (image_data, height, width)

def _process_image ( filename , coder ) : with tf . gfile . FastGFile ( filename , 'r' ) as f : image_data = f . read ( ) if _is_png ( filename ) : print ( ( 'Converting PNG to JPEG for %s' % filename ) ) image_data = coder . png_to_jpeg ( image_data ) image = coder . decode_jpeg ( image_data ) assert ( len ( image . shape ) == 3 ) height = image . shape [ 0 ] width = image . shape [ 1 ] assert ( image . shape [ 2 ] == 3 ) return ( image_data , height , width )
process a single image file .