def get_im_version():
 try:
  out = util.command_output(['convert', '--version'])
  if ('imagemagick' in out.lower()):
   pattern = '.+ (\\d+)\\.(\\d+)\\.(\\d+).*'
   match = re.search(pattern, out)
   if match:
    return (int(match.group(1)), int(match.group(2)), int(match.group(3)))
   return (0,)
 except (subprocess.CalledProcessError, OSError) as exc:
  log.debug(u'ImageMagick check `convert --version` failed: {}', exc)
  return None

def get_im_version ( ) : try : out = util . command_output ( [ 'convert' , '--version' ] ) if ( 'imagemagick' in out . lower ( ) ) : pattern = '.+ (\\d+)\\.(\\d+)\\.(\\d+).*' match = re . search ( pattern , out ) if match : return ( int ( match . group ( 1 ) ) , int ( match . group ( 2 ) ) , int ( match . group ( 3 ) ) ) return ( 0 , ) except ( subprocess . CalledProcessError , OSError ) as exc : log . debug ( u'ImageMagick check `convert --version` failed: {}' , exc ) return None
return image magick version or none if it is unavailable try invoking imagemagicks "convert" .