(self, filename)
return new_im
根据图片位置合并还原
        :param filename: 图片
        :param location: 位置
        :return:合并后的图片对象
根据图片位置合并还原
        :param filename: 图片
        :param location: 位置
        :return:合并后的图片对象
根据图片位置合并还原 : param filename : 图片 : param location : 位置 : return : 合并后的图片对象
def get_merge_image(self, filename):
        """
        根据图片位置合并还原
        :param filename: 图片
        :param location: 位置
        :return:合并后的图片对象
        """
        im = Image.open(filename)
        width, height = im.size

        new_im = Image.new('RGB', (260, height))
        im_list_upper = []
        im_list_lower = []

        for location in self.location_list:
            if location['y'] == -58:
                im_list_upper.append(im.crop((abs(location['x']), height//2, abs(location['x']) + 10, height)))
            if location['y'] == 0:
                im_list_lower.append(im.crop((abs(location['x']), 0, abs(location['x']) + 10, height//2)))

        x_offset = 0
        for img in im_list_upper:
            new_im.paste(img, (x_offset, 0))
            x_offset += img.size[0]

        x_offset = 0
        for img in im_list_lower:
            new_im.paste(img, (x_offset, height//2))
            x_offset += img.size[0]
        return new_im
def get_merge_image ( self , filename ) : im = Image . open ( filename ) width , height = im . size new_im = Image . new ( 'RGB' , ( 260 , height ) ) im_list_upper = [ ] im_list_lower = [ ] for location in self . location_list : if location [ 'y' ] == - 58 : im_list_upper . append ( im . crop ( ( abs ( location [ 'x' ] ) , height // 2 , abs ( location [ 'x' ] ) + 10 , height ) ) ) if location [ 'y' ] == 0 : im_list_lower . append ( im . crop ( ( abs ( location [ 'x' ] ) , 0 , abs ( location [ 'x' ] ) + 10 , height // 2 ) ) ) x_offset = 0 for img in im_list_upper : new_im . paste ( img , ( x_offset , 0 ) ) x_offset += img . size [ 0 ] x_offset = 0 for img in im_list_lower : new_im . paste ( img , ( x_offset , height // 2 ) ) x_offset += img . size [ 0 ] return new_im