In Blender when rendering with Transparent background and saving transparency with .png file, is it possible to save the png with GIMP's option:

Save color values from transparent pixels ?

enter image description here

How to achieve Alpha 1 transparency with Blender compositor?

enter image description here

  • $\begingroup$ blender.stackexchange.com/questions/1303/… $\endgroup$
    – user1853
    Dec 23 '16 at 17:34
  • $\begingroup$ "is it possible to save the png with GIMP's option" - can you clarify what is your question ? Which setting of GIMP are you referring to ? Why do you search for exact that setting inside of another program ? $\endgroup$
    – Mr Zak
    Dec 23 '16 at 17:38
  • 1
    $\begingroup$ @DanMonsic If you are rendering with transparent background the background will have black color value. $\endgroup$
    – Denis
    Dec 23 '16 at 18:00
  • 1
    $\begingroup$ All that is necessary to save image with alpha channel is already described in the linked answer - enable RGBA for image file to be saved (works not only for .png which is best to avoid, but for all other image formats as well). If you save image which was rendered with Transparent enabled and check RGBA prior to saving your image will have alpha channel. $\endgroup$
    – Mr Zak
    Dec 23 '16 at 18:14
  • 1
    $\begingroup$ unless Alpha 1 means 1-bit alpha. If that's the case, Blender does not produce that kind of images (paletted with 1 bit alpha). $\endgroup$
    – Gez
    Dec 26 '16 at 2:53

PNG is an unassociated alpha image format, while Blender, as any other 3D renderer produce associated (often called premultiplied) alpha images. To produce an unassociated alpha image using the compositor, you have to "pre-divide" the alpha channel and connect the unassociated RGB to the composite output and the alpha socket of the same node. You can unassociate the alpha channel using an Alpha convert node (using the "premul to straight" mode) or just divide the rendered image by its alpha with a mix node (divide mode).

That's the correct way to save unassociated from Blender if it has to be predivided manually for any reason, otherwise Blender does the predivision automatically when PNG is selected as output (and in that case it's not necessary to manually connect alpha to the output).

PNG will always save the RGB information of transparent pixels because it is an unassociated alpha format. However, producing an unassociated alpha image from an associated image is a destructive process, because it has to be divided (and alpha zero pixels are discarded). Saving an associated image as PNG is not allowed by the format, so it's important to keep in mind that any hack used to produce a PNG as described by the OP will produce an invalid image that is likely to produce edge artifacts when composited.

It is strongly advised to respect the alpha association dictated by the format and avoid this kind of hacks if PNG has to be used.


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.