def paste(self, other_engine, pos, merge=True): if merge and not FILTERS_AVAILABLE: raise RuntimeError( "You need filters enabled to use paste with merge. Please reinstall " + "thumbor with proper compilation of its filters.") self.enable_alpha() other_engine.enable_alpha() image = self.image other_image = other_engine.image if merge: image_size = self.size other_size = other_engine.size mode, data = self.image_data_as_rgb() _, other_data = other_engine.image_data_as_rgb() imgdata = _composite.apply( mode, data, image_size[0], image_size[1], other_data, other_size[0], other_size[1], int(pos[0]), int(pos[1]), ) self.set_image_data(imgdata) else: image.paste(other_image, pos)
def paste(self, other_engine, pos, merge=True): if merge and not FILTERS_AVAILABLE: raise RuntimeError( "You need filters enabled to use paste with merge. Please reinstall " + "thumbor with proper compilation of its filters." ) self.enable_alpha() other_engine.enable_alpha() image = self.image other_image = other_engine.image if merge: sz = self.size other_size = other_engine.size imgdata = _composite.apply( self.get_image_mode(), self.get_image_data(), sz[0], sz[1], other_engine.get_image_data(), other_size[0], other_size[1], pos[0], pos[1], ) self.set_image_data(imgdata) else: image.paste(other_image, pos)
def paste(self, other_engine, pos, merge=True): self.enable_alpha() other_engine.enable_alpha() image = self.image other_image = other_engine.image if merge: sz = self.size other_size = other_engine.size imgdata = _composite.apply(self.get_image_mode(), self.get_image_data(), sz[0], sz[1], other_engine.get_image_data(), other_size[0], other_size[1], pos[0], pos[1]) self.set_image_data(imgdata) else: image.paste(other_image, pos)
def paste(self, other_engine, pos, merge=True): if merge and not FILTERS_AVAILABLE: raise RuntimeError( 'You need filters enabled to use paste with merge. Please reinstall ' + 'thumbor with proper compilation of its filters.') self.enable_alpha() other_engine.enable_alpha() sz = self.size other_size = other_engine.size mode, data = self.image_data_as_rgb() other_mode, other_data = other_engine.image_data_as_rgb() imgdata = _composite.apply( mode, data, sz[0], sz[1], other_data, other_size[0], other_size[1], pos[0], pos[1], merge) self.set_image_data(imgdata)