1
$\begingroup$

I have a script to create an image but i want it to be created with transparency:

import bpy

bpy.data.images.new("albedo", width=1024, height=1024)
$\endgroup$
2
$\begingroup$

It depends on what you are actually asking:

  • If you need ot create an RGBA image, so an image that also has the Alpha Channel. (So a RGBA type instead of the normal RGB). Just Check ALPHA when you create it via UI or in code:

    bpy.data.images.new("albedo", width=1024, height=1024, alpha = True)

  • If you want the default color to be instead of black any other color so even one with some transparency, this is the fastest way I found:

    im = bpy.data.images.new("albedo", width=1024, height=1024, alpha = True) im.generated_color = (1,0,0,0.5)

This code actually generates a Red image half transparent.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.