#NEWLINE# def _get_raw_data( self , image , format , quality ) : #NEWLINE# #INDENT# "\n        Returns the raw data from the Image, which can be directly written\n        to a something, be it a file-like object or a database.\n\n        :param PIL.Image image: The image to get the raw data for.\n        :param str format: The format to save to. If this value is ``None``,\n            PIL will attempt to guess. You're almost always better off\n            providing this yourself. For a full list of formats, see the PIL\n            handbook at:\n            http://www.pythonware.com/library/pil/handbook/index.htm\n            The *Appendixes* section at the bottom, in particular.\n        :param int quality: A quality level as a percent. The lower, the\n            higher the compression, the worse the artifacts. Check the\n            format's handbook page for what the different values for this mean.\n            For example, JPEG's max quality level is 95, with 100 completely\n            disabling JPEG quantization.\n        :rtype: str\n        :returns: A string representation of the image.\n        " #NEWLINE# ImageFile . MAXBLOCK = ( 1024 * 1024 ) #NEWLINE# buf = StringIO ( ) #NEWLINE# try : #NEWLINE# #INDENT# image . save ( buf , format = format , quality = quality , optimize = 1 ) #NEWLINE# #UNINDENT# except IOError : #NEWLINE# #INDENT# image . save ( buf , format = format , quality = quality ) #NEWLINE# #UNINDENT# raw_data = buf . getvalue ( ) #NEWLINE# buf . close ( ) #NEWLINE# return image