Change the color of a specific layer with psd-tools

133 Views Asked by At
from psd_tools import PSDImage
from PIL import Image

psd = PSDImage.open('file.psd')


for layer in psd:
    if layer.name == 'bg':
        pil_image = Image.new('RGB', layer.size, color='black')
        layer._record._image_data = pil_image.tobytes()

psd.save('savedfile.psd')

Can't I change the color of a specific layer?

If you run the above code, it will have no effect.

0

There are 0 best solutions below