def thumbnail(self, size, resample=NEAREST):
        "Create thumbnail representation (modifies image in place)"

        # FIXME: the default resampling filter will be changed
        # to ANTIALIAS in future versions

        # preserve aspect ratio
        x, y = self.size
        if x > size[0]: y = max(y * size[0] / x, 1); x = size[0]
        if y > size[1]: x = max(x * size[1] / y, 1); y = size[1]
        size = x, y

        if size == self.size:
            return

        self.draft(None, size)

        self.load()

        try:
            im = self.resize(size, resample)
        except __HOLE__:
            if resample != ANTIALIAS:
                raise
            im = self.resize(size, NEAREST) # fallback

        self.im = im.im
        self.mode = im.mode
        self.size = size

        self.readonly = 0

    # FIXME: the different tranform methods need further explanation
    # instead of bloating the method docs, add a separate chapter.

    ##
    # Transforms this image.  This method creates a new image with the
    # given size, and the same mode as the original, and copies data
    # to the new image using the given transform.
    # <p>
    # @def transform(size, method, data, resample=NEAREST)
    # @param size The output size.
    # @param method The transformation method.  This is one of
    #   <b>EXTENT</b> (cut out a rectangular subregion), <b>AFFINE</b>
    #   (affine transform), <b>PERSPECTIVE</b> (perspective
    #   transform), <b>QUAD</b> (map a quadrilateral to a
    #   rectangle), or <b>MESH</b> (map a number of source quadrilaterals
    #   in one operation).
    # @param data Extra data to the transformation method.
    # @param resample Optional resampling filter.  It can be one of
    #    <b>NEAREST</b> (use nearest neighbour), <b>BILINEAR</b>
    #    (linear interpolation in a 2x2 environment), or
    #    <b>BICUBIC</b> (cubic spline interpolation in a 4x4
    #    environment). If omitted, or if the image has mode
    #    "1" or "P", it is set to <b>NEAREST</b>.
    # @return An Image object.
dataset/ETHPy150Open kleientertainment/ds_mod_tools/pkg/win32/Python27/Lib/site-packages/PIL/Image.py/Image.thumbnail