def profileToProfile(im, inputProfile, outputProfile, renderingIntent=INTENT_PERCEPTUAL, outputMode=None, inPlace=0, flags=0):
 if (outputMode is None):
  outputMode = im.mode
 if ((not isinstance(renderingIntent, int)) or (not (0 <= renderingIntent <= 3))):
  raise PyCMSError('renderingIntent must be an integer between 0 and 3')
 if ((not isinstance(flags, int)) or (not (0 <= flags <= _MAX_FLAG))):
  raise PyCMSError(('flags must be an integer between 0 and %s' + _MAX_FLAG))
 try:
  if (not isinstance(inputProfile, ImageCmsProfile)):
   inputProfile = ImageCmsProfile(inputProfile)
  if (not isinstance(outputProfile, ImageCmsProfile)):
   outputProfile = ImageCmsProfile(outputProfile)
  transform = ImageCmsTransform(inputProfile, outputProfile, im.mode, outputMode, renderingIntent, flags=flags)
  if inPlace:
   transform.apply_in_place(im)
   imOut = None
  else:
   imOut = transform.apply(im)
 except (IOError, TypeError, ValueError) as v:
  raise PyCMSError(v)
 return imOut

def profileToProfile ( im , inputProfile , outputProfile , renderingIntent = INTENT_PERCEPTUAL , outputMode = None , inPlace = 0 , flags = 0 ) : if ( outputMode is None ) : outputMode = im . mode if ( ( not isinstance ( renderingIntent , int ) ) or ( not ( 0 <= renderingIntent <= 3 ) ) ) : raise PyCMSError ( 'renderingIntent must be an integer between 0 and 3' ) if ( ( not isinstance ( flags , int ) ) or ( not ( 0 <= flags <= _MAX_FLAG ) ) ) : raise PyCMSError ( ( 'flags must be an integer between 0 and %s' + _MAX_FLAG ) ) try : if ( not isinstance ( inputProfile , ImageCmsProfile ) ) : inputProfile = ImageCmsProfile ( inputProfile ) if ( not isinstance ( outputProfile , ImageCmsProfile ) ) : outputProfile = ImageCmsProfile ( outputProfile ) transform = ImageCmsTransform ( inputProfile , outputProfile , im . mode , outputMode , renderingIntent , flags = flags ) if inPlace : transform . apply_in_place ( im ) imOut = None else : imOut = transform . apply ( im ) except ( IOError , TypeError , ValueError ) as v : raise PyCMSError ( v ) return imOut
applies an icc transformation to a given image .