parameters: (self, format, **kw)
return_statement: return mime, image_data
docstring: Implementation of conversion for Image files
docstring_summary: Implementation of conversion for Image files
docstring_tokens: Implementation of conversion for Image files
function: def _convert(self, format, **kw):  # pylint: disable=redefined-builtin
      """
      Implementation of conversion for Image files
      """
      if format == 'svg' and self.getContentType()=='image/svg+xml':
        # SVG format is a textual data which can be returned as it is
        # so client (browser) can draw an image out of it
        return self.getContentType(), self.getData()
  
      if format in VALID_TEXT_FORMAT_LIST:
        try:
          return self.getConversion(format=format)
        except KeyError:
          mime_type, data = self._convertToText(format)
          data = aq_base(data)
          self.setConversion(data, mime=mime_type, format=format)
          return mime_type, data
      if not (format or kw):
        # User asked for original content
        return self.getContentType(), self.getData()
      image_size = self.getSizeFromImageDisplay(kw.get('display'))
      # store all keys usefull to convert or resize an image
      # 'display' parameter can be discarded
      quality = kw.get('quality', _MARKER)
      if quality is _MARKER:
        quality = self.getDefaultImageQuality(format)
      kw['format'] = format
      kw['quality'] = quality
      try:
        mime, image_data = self.getConversion(**kw)
      except KeyError:
        # we need to convert string representation (i.e. display=small) to a
        # pixel (number of it = 128x128)
        kw['image_size'] = image_size
        display = kw.pop('display', None)
        crop = kw.pop('crop', None)
        mime, image_data = self._getContentTypeAndImageData(
            format=format,
            quality=quality,
            resolution=kw.get('resolution'),
            frame=kw.get('frame'),
            image_size=image_size,
            crop=crop,
        )
        # as image will always be requested through a display not by passing exact
        # pixels we need to restore this way in cache
        if display is not None:
          # only set if we have a real value
          kw['display'] = display
        if crop:
          kw['crop'] = crop
        image_size = kw.pop('image_size', None)
        self.setConversion(image_data, mime, **kw)
      return mime, image_data
function_tokens: def _convert ( self , format , * * kw ) : # pylint: disable=redefined-builtin if format == 'svg' and self . getContentType ( ) == 'image/svg+xml' : # SVG format is a textual data which can be returned as it is # so client (browser) can draw an image out of it return self . getContentType ( ) , self . getData ( ) if format in VALID_TEXT_FORMAT_LIST : try : return self . getConversion ( format = format ) except KeyError : mime_type , data = self . _convertToText ( format ) data = aq_base ( data ) self . setConversion ( data , mime = mime_type , format = format ) return mime_type , data if not ( format or kw ) : # User asked for original content return self . getContentType ( ) , self . getData ( ) image_size = self . getSizeFromImageDisplay ( kw . get ( 'display' ) ) # store all keys usefull to convert or resize an image # 'display' parameter can be discarded quality = kw . get ( 'quality' , _MARKER ) if quality is _MARKER : quality = self . getDefaultImageQuality ( format ) kw [ 'format' ] = format kw [ 'quality' ] = quality try : mime , image_data = self . getConversion ( * * kw ) except KeyError : # we need to convert string representation (i.e. display=small) to a # pixel (number of it = 128x128) kw [ 'image_size' ] = image_size display = kw . pop ( 'display' , None ) crop = kw . pop ( 'crop' , None ) mime , image_data = self . _getContentTypeAndImageData ( format = format , quality = quality , resolution = kw . get ( 'resolution' ) , frame = kw . get ( 'frame' ) , image_size = image_size , crop = crop , ) # as image will always be requested through a display not by passing exact # pixels we need to restore this way in cache if display is not None : # only set if we have a real value kw [ 'display' ] = display if crop : kw [ 'crop' ] = crop image_size = kw . pop ( 'image_size' , None ) self . setConversion ( image_data , mime , * * kw ) return mime , image_data