1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] How Can I Use Python to Output Mutiple PNGs as a layered Image File PSD/XCF

Discussão em 'Python' iniciado por Stack, Outubro 7, 2024 às 08:12.

  1. Stack

    Stack Membro Participativo

    I have looked at mutiple answers before posting this question but am finding these difficult to understand.

    The question is:

    I currently have a script which combines a total of 7 pngs from 7 different folders to create a single png image. The script chooses a png from each folder randomly to create a unique combination for the final single png image. The script allows you to set how many images you want, and dependent on the number of images chosen that number of images are created, each with its own unique combination.

    What I would like to do is create either an XCF,PSD or any other easily accessible/opensource layered image file for each combination created, each layer should be each png file chosen from each of the 7 folders.

    I cannot post the full code here, but the code which is most relevant to the question is here:

    Create each composite


    com1 = Image.alpha_composite(im1, im2)
    com2 = Image.alpha_composite(com1, im3)
    com3 = Image.alpha_composite(com2, im4)
    com4 = Image.alpha_composite(com3, im5)
    com5 = Image.alpha_composite(com4, im6)
    com6 = Image.alpha_composite(com5, im7)

    # Convert to RGB
    # rgb_im = com5.convert('RGB')
    rgb_im = com6.convert('RGBA')

    file_name = str(item["tokenId"]) + ".png"
    rgb_im.save("./images/" + file_name)
    dump_meta(all_images[count - 1]


    Any help would be greatly appreciated and thank you for taking the time to read this.

    Continue reading...

Compartilhe esta Página