Notifications
Clear all

[Closed] How to save image with transparent background

Hello
I’m trying to save image with transparent background. I know that there is a checkpoint Preferences->Rendering->Background->Use Environment Alpha.

If im saving image manually with turned on “Use Environment Alpha” – the image has transparent background. But if im saving image with script the image has black background =(

Here is my code example:

f = "D:\\1.max"
    mergemaxfile f #select;
    renderFilename = getFilenameFile f + ".png";

    pngio.setAlpha true;
    pngio.setType #true48;
    rendOutputFilename = "D:\\"+renderFilename;
    rendsavefile = true;
    bm = render();
    bm.FileName = "D:\\"+renderFilename;
    save bm;

    delete selection;

I’m using Vray 2.40 for render
After render finished there is an image in V-Ray frame buffer and saved file D:\1.png with black background. Then i’m saving image manually from V-Ray frame buffer and background is transparent as i told up there.

I dont understand what im doing wrong How to save image with transparent background with maxscript?

2 Replies

no error for me:


 	delete objects	
   	plane width:200 length:200
   	teapot()
   	
   	pngio.setAlpha true;
   	pngio.setType #true24;		-- also works for #true48
   	bm = render();
   	bm.FileName = "D:\	est.png";
   	save bm;
   

In windows explorer, the preview still shows black background but if you open it in photoshop alpha is here.

the problem was in Vray Frame Buffer…
I’ve turned off “Enable built-in Frame Buffer” (render setup->V-Ray->V-RayLL Frame buffer) and now its all OK! SUDDENLY o_O