def count_images(layers): for layer in layers: if layer.kind == 'group': if layer.name.lower() == 'background' or 'text -' in layer.name.lower(): continue count_images(layer) else: add_log('total', 1)
def write_file_thumbnail_png(layer, current_path): if not os.path.isfile(f'{current_path}/{layer.name}.png'): layer.visible = True image = layer.composite() image.save(f'{current_path}/{layer.name}.png') print(f'save successfully file: {layer.name}') add_log('image', 1) get_log() layer.visible = False
def write_file_png(name, path, branch, current_path): if not os.path.isfile(f'{current_path}/{name}.png'): layer_img = PSDImage.open(path) set_visible_all(layer_img, False) set_visible(layer_img, False) visible_branch(layer_img, branch) image = layer_img.composite(ignore_preview=True) image.save(f'{current_path}/{name}.png') add_log('image', 1) print(f'save successfully file: {name}') get_log()