PNG Export with transparent background

Next
 From:  noskule
8746.1 
Hi All
I would like to export a png with transparent background and cant figure out how to define the transparent background, thats what I have so far:

script: /* Custom screenshot */ var prev_background = moi.view.viewportBackgroundColor; moi.view.viewportBackgroundColor = 0xFFFFFF; moi.view.lineWidth = 3; moi.grid.display = false; moi.grid.showXYAxes = false; moi.view.showAxisIcon = false; moi.view.meshAngle = 3; var v = moi.ui.getActiveViewport(); if ( v != null ) { moi.view.lineWidth = 4; var img = v.render( 3840, 2160 ); moi.view.lineWidth = 1; var name = img.getSaveFileName(); if ( name != '' ) img.save( name ); }moi.view.lineWidth = 1; moi.grid.display = true; moi.grid.showXYAxes = true; moi.view.showAxisIcon = true; moi.view.meshAngle = 8; moi.view.viewportBackgroundColor = prev_background;

Has anyone an idea how to define "viewportBackgroundColor" or how can I do it?

Thanks Ben
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Michael Gibson
8746.2 In reply to 8746.1 
Hi Ben, there isn't any way for that particular rendering method to generate a transparent background.

But there is another way you could get one - if you do an export to .ai format, and check the option for generating a shaded background image, there will be a companion PNG file generated along with the .ai file and that PNG file will have a transparent background.

Also if you export to PDF format, the PDF will contain in it the same kind of bitmap which you could probably extract with copy/paste.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All