[Plugin] Export 2d with Alpha

[Plugin] Export 2d with Alpha

Postby thomthom » Mon Sep 13, 2010 6:41 pm

Overview
Exports the current view with transparent background option (SU8) if you use the PNG format. Will also let you export only what is displayed on your screen - where SketchUp's native Export 2D function would export the whole model, regardless.

Access
View > Export 2D

Usage
TT_Export2d.png


ExportSaveAs.png


ant.png


Requirements
  • SketchUp 7 or newer - ( Other versions untested )
  • TT_Lib2

Download



Footprint
<Sketchup>/Plugins/
+-
tt_export.rb

4
Last edited by thomthom on Fri Nov 29, 2013 12:21 am, edited 1 time in total.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby Ben Ritter » Mon Sep 13, 2010 7:35 pm

Thomas, thank you once again and happy Monday.
0

Ben Ritter 
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby JClements » Mon Sep 13, 2010 8:48 pm

Thomas, this is great. I use the transparent PNG format for most all of my work so I can do compositing.

A few weeks ago I had to make a 4' x 3' poster. Layout couldn't export the PNG because, I think because of the all the textures I had combined with the anti-aliasing of LayOut's export filter). My old workaround was to make all layers Black and then turn on color by layer to produce a black and white mask for an Alpha Channel but that doesn't work with textures that are comprised of transparent PNGs. Hopefully, this script will address these type of textures.

This could be script my workaround for transparent PNG's. I will give it a test.

Thank you !


[Edit] P.S. I am going to change the name, however, to "tt_eportPNG.rb" ... incase you come up with some other export options
0
Last edited by JClements on Mon Sep 13, 2010 9:00 pm, edited 3 times in total.
John
Illustrator
Beaverton, Oregon
User avatar
JClements 
Premium Member
Premium Member
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby Pixero » Mon Sep 13, 2010 8:55 pm

Thanks, but I'm curious...how does it work?
Was transparency there all along but the built in exporter couldn't handle it?
:?
0
User avatar
Pixero 
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby JClements » Mon Sep 13, 2010 9:35 pm

Thomas, so far so good. I exported a 4,000 x 2,000 pix file no problem. I haven't tried using sketchy edge styles with it yet.

Q- Would it be possible to read the aspect ratio of the users model window and give that as an option in your dropdown list?


If you'd like a model to do tests with I can arrange to send one that could push the script to it's limits. Let me know.
0
John
Illustrator
Beaverton, Oregon
User avatar
JClements 
Premium Member
Premium Member
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby thomthom » Mon Sep 13, 2010 9:51 pm

Pixero wrote:Was transparency there all along but the built in exporter couldn't handle it?

Added with the SU8 API.


JClements wrote:Q- Would it be possible to read the aspect ratio of the users model window and give that as an option in your dropdown list?

I can read the aspect ratio - but I can't make the values in the inputbox interactively change. I'd have to make a webdialog for that.

JClements wrote:If you'd like a model to do tests with I can arrange to send one that could push the script to it's limits. Let me know.

I really have no control over what it can export. It simply calls the SU API: view.write_image - so I'm not doing anything different from what SU does - because it's all SU.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby CadFather » Mon Sep 13, 2010 10:10 pm

Master Thom Thom strikes again! :shock: (a true gem)

now i know why the name: it's two of you!! thank you, thank you
0
Quarr-IT - SketchUp Training from the Master.. http://quarr-it.com/
User avatar
CadFather 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby JClements » Mon Sep 13, 2010 10:16 pm

Thomas, if you could just display the aspect ratio that would be helpful. I could manually enter values using a calculator.

John
0
John
Illustrator
Beaverton, Oregon
User avatar
JClements 
Premium Member
Premium Member
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby EscapeArtist » Mon Sep 13, 2010 10:29 pm

Great! I needed something like this last week, how did you know?

Thanks for another useful plugin! :thumb:
0
User avatar
EscapeArtist 
Top SketchUcator
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby thomthom » Mon Sep 13, 2010 10:33 pm

JClements wrote:Thomas, if you could just display the aspect ratio that would be helpful. I could manually enter values using a calculator.

John

I'll see what I can do. I am currently working on a system to make advanced inputboxes easier to make.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby JClements » Mon Sep 13, 2010 11:05 pm

Thomas. Not urgent by any means.
0
John
Illustrator
Beaverton, Oregon
User avatar
JClements 
Premium Member
Premium Member
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby Pixero » Tue Sep 14, 2010 7:21 am

thomthom wrote:•SketchUp 7 or newer

thomthom wrote:Added with the SU8 API.



So...how do I get this to work with SU 7.1?
It exports without transparency and always the whole model.
0
User avatar
Pixero 
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby thomthom » Tue Sep 14, 2010 7:26 am

Pixero wrote:So...how do I get this to work with SU 7.1?
Transparency? You can't.

Pixero wrote:and always the whole model.

hmm, not on my machine - remember to Hide Rest of Model. WYSIWYG.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby Pixero » Tue Sep 14, 2010 7:59 am

thomthom wrote:
Pixero wrote:So...how do I get this to work with SU 7.1?
thomthom wrote: Transparency? You can't.


:cry:
0
Last edited by Pixero on Tue Sep 14, 2010 9:46 am, edited 2 times in total.
User avatar
Pixero 
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby rv1974 » Tue Sep 14, 2010 9:19 am

Is there some way to separate shadows pass?
0

rv1974 
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby thomthom » Tue Sep 14, 2010 9:46 am

No - I have no control of how it's generated. As you see from the sample I posted the shadows even comes from the whole model, not just what is visible.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby Pixero » Tue Sep 14, 2010 10:41 am

thomthom wrote:No - I have no control of how it's generated. As you see from the sample I posted the shadows even comes from the whole model, not just what is visible.


This can help for a shadow pass: http://rhin.crai.archi.fr/RubyLibraryDe ... emplate.rb

And maybe a modification of my Shadow control script (http://www.pixero.com/downloads_sketchup.html) could be made to set everything not selected to: e.casts_shadows = false
0
User avatar
Pixero 
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby archworks » Wed Nov 24, 2010 3:25 pm

Congratulations - one of the best for su 2d app
0

archworks 
Premium Member
Premium Member
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby Gaieus » Wed Nov 24, 2010 4:33 pm

Hey, I did not see this, great plugin, thanks Thom! :thumb: :thumb: :thumb:
_______

Edit; to me, it does not export with transparent background... Nor does it export only the active context. :(

test.png
0
User avatar
Gaieus 
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby thomthom » Wed Nov 24, 2010 6:04 pm

Gaieus wrote:Edit; to me, it does not export with transparent background... Nor does it export only the active context. :(

What version of SU did you use?
Got a screencapture?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby Humpmetwice » Wed Nov 24, 2010 6:34 pm

Have I put something in the wrong spot or something cause when I go to view/export 2D the settings comes up but then it doesn't give me a file type to save it as?
0
User avatar
Humpmetwice 
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby thomthom » Wed Nov 24, 2010 6:47 pm

humpmetwice wrote:Have I put something in the wrong spot or something cause when I go to view/export 2D the settings comes up but then it doesn't give me a file type to save it as?

After the Settings window and you click OK you should get a File Dialog asking you what name to give the file. You must specify the file extension yourself.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby Humpmetwice » Wed Nov 24, 2010 7:16 pm

thomthom wrote:After the Settings window and you click OK you should get a File Dialog asking you what name to give the file. You must specify the file extension yourself.


I know and it doesn't give me any file type to save it as at all.
0
User avatar
Humpmetwice 
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby thomthom » Wed Nov 24, 2010 7:29 pm

You have to type the file type yourself - there is no list of file types because the SketchUp Ruby API doesn't let me provide one.

So if you want to save a jpg file just enter "myfile.jpg" in the file dialog.
filedialog.png
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby Gaieus » Thu Nov 25, 2010 11:37 pm

thomthom wrote:
Gaieus wrote:Edit; to me, it does not export with transparent background... Nor does it export only the active context. :(

What version of SU did you use?
Got a screencapture?

The most recent one; SU 8.

Here is a screen capture; now with a different codec than the one you could not open the other day if you remember...
0
User avatar
Gaieus 
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby thomthom » Fri Nov 26, 2010 9:18 am

That baffles me. I have no idea why this happens. Exactly the same works for me... :?: :? :?:
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby Gaieus » Fri Nov 26, 2010 9:51 am

Well, sigh... I can always use LO for exporting png's with transparent background...

Maybe it's an XP thing?
0
User avatar
Gaieus 
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby thomthom » Fri Nov 26, 2010 9:54 am

I don't know. Haven't got an XP machine at hand right now. Could be an SketchUp bug...
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby Gaieus » Fri Nov 26, 2010 10:35 am

Well, you know where to report it (and who has all sorts of machines). I have no clue about the ins and outs of ruby. I could never make a proper bug report on plugins!
:)
0
User avatar
Gaieus 
 

Re: [Plugin] Export 2d with Alpha (1.0.1) — 13 September 201

Postby thomthom » Fri Nov 26, 2010 11:08 am

Just to narrow it down to a simple test case - can you try this one-liner?
Code: Select all
Sketchup.active_model.active_view.write_image( { :filename=>'C:\test.png', :width=>640, :height=>480, :antialias=>false, :transparent=>true } ) 
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: Carto, Google Bot and 12 guests

Visit our sponsors: