def crop_avatar(self, filename, x, y, w, h):
x = int(x)<EOL>y = int(y)<EOL>w = int(w)<EOL>h = int(h)<EOL>sizes = current_app.config['<STR_LIT>']<EOL>if not filename:<EOL><INDENT>path = os.path.join(self.root_path, '<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>path = os.path.join(current_app.config['<STR_LIT>'], filename)<EOL><DEDENT>print(path)<EOL>raw_img = Image.open(path)<EOL>base_width = current_app.config['<STR_LIT>']<EOL>if raw_img.size[<NUM_LIT:0>] >= base_width:<EOL><INDENT>raw_img = self.resize_avatar(raw_img, base_width=base_width)<EOL><DEDENT>cropped_img = raw_img.crop((x, y, x + w, y + h))<EOL>filename = uuid4().hex<EOL>avatar_s = self.resize_avatar(cropped_img, base_width=sizes[<NUM_LIT:0>])<EOL>avatar_m = self.resize_avatar(cropped_img, base_width=sizes[<NUM_LIT:1>])<EOL>avatar_l = self.resize_avatar(cropped_img, base_width=sizes[<NUM_LIT:2>])<EOL>filename_s = filename + '<STR_LIT>'<EOL>filename_m = filename + '<STR_LIT>'<EOL>filename_l = filename + '<STR_LIT>'<EOL>path_s = os.path.join(current_app.config['<STR_LIT>'], filename_s)<EOL>path_m = os.path.join(current_app.config['<STR_LIT>'], filename_m)<EOL>path_l = os.path.join(current_app.config['<STR_LIT>'], filename_l)<EOL>avatar_s.save(path_s, optimize=True, quality=<NUM_LIT>)<EOL>avatar_m.save(path_m, optimize=True, quality=<NUM_LIT>)<EOL>avatar_l.save(path_l, optimize=True, quality=<NUM_LIT>)<EOL>return [filename_s, filename_m, filename_l]<EOL>
Crop avatar with given size, return a list of file name: [filename_s, filename_m, filename_l].

        :param filename: The raw image's filename.
        :param x: The x-pos to start crop.
        :param y: The y-pos to start crop.
        :param w: The crop width.
        :param h: The crop height.