parameters: (media)
return_statement: return Status.SUCCESS
docstring: Process one image: resize, create thumbnail.
docstring_summary: Process one image: resize, create thumbnail.
docstring_tokens: Process one image : resize create thumbnail .
function: def process_image(media):
      """Process one image: resize, create thumbnail."""
  
      logger = logging.getLogger(__name__)
      logger.info('Processing %s', media.src_path)
  
      if media.src_ext in ('.jpg', '.jpeg', '.JPG', '.JPEG'):
          options = media.settings['jpg_options']
      elif media.src_ext == '.png':
          options = {'optimize': True}
      else:
          options = {}
  
      try:
          generate_image(media.src_path, media.dst_path, media.settings, options=options)
  
          if media.settings['make_thumbs']:
              generate_thumbnail(
                  media.dst_path,
                  media.thumb_path,
                  media.settings['thumb_size'],
                  fit=media.settings['thumb_fit'],
                  options=options,
                  thumb_fit_centering=media.settings["thumb_fit_centering"],
              )
      except Exception as e:
          logger.info('Failed to process: %r', e)
          if logger.getEffectiveLevel() == logging.DEBUG:
              raise
          else:
              return Status.FAILURE
  
      return Status.SUCCESS
function_tokens: def process_image ( media ) : logger = logging . getLogger ( __name__ ) logger . info ( 'Processing %s' , media . src_path ) if media . src_ext in ( '.jpg' , '.jpeg' , '.JPG' , '.JPEG' ) : options = media . settings [ 'jpg_options' ] elif media . src_ext == '.png' : options = { 'optimize' : True } else : options = { } try : generate_image ( media . src_path , media . dst_path , media . settings , options = options ) if media . settings [ 'make_thumbs' ] : generate_thumbnail ( media . dst_path , media . thumb_path , media . settings [ 'thumb_size' ] , fit = media . settings [ 'thumb_fit' ] , options = options , thumb_fit_centering = media . settings [ "thumb_fit_centering" ] , ) except Exception as e : logger . info ( 'Failed to process: %r' , e ) if logger . getEffectiveLevel ( ) == logging . DEBUG : raise else : return Status . FAILURE return Status . SUCCESS