cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
Ingerid
Level II

Output picture size in pixels

Hi!

I have a large series of plots that I need to output as png, emf and svg, and they have to be exactly 500x300 pixels. This has proven incredibly difficult to achieve. I know that I can specify the size of the graph builder using Size(), but that results in a plot that is significantly larger due to added axis titles, plot title, legends, margins and such.

To explain what I'm doing: I add an OnOpen script to my datatable which plots my data using the Graph builder, and create a report and use that to add axis titles and such. I have another script that opens the data table and extracts the picturebox from the generated report. This is then put into a VListBox together with plot titles and such. This box is then exported using SavePicture().

vlb = VListBox(
	Align(center),
	tb1 = TextBox(
		"",
		SetFontSize(numFONTSIZETITLE),
		SetFontStyle(strFONTSTYLETITLE),
		SetFont(strFONTITLE),
		SetWrap(0.9*numLENGTHEXPORT)),
	tb2 = TextBox(
		"Title",
		SetFontSize(numFONTSIZETITLE),
		SetFontStyle(strFONTSTYLETITLE),
		SetFont(strFONTITLE),
		SetWrap(0.9*numLENGTHEXPORT)),
	tb3 = TextBox(
		strComments,
		SetFontSize(numFONTSIZECOMMENTS),
	        SetFontStyle(strFONTSTYLECOMMENTS),
		SetFont(strFONTCOMMENTS),
		SetWrap(0.9*numLENGTHEXPORT)),
	pb1 = reportgraphbuilder[PictureBox(1)]
);
vlb << Save Picture(drFolderSave || strPlotName || ".emf", emf);
vlb << Save Picture(drFolderSave || strPlotName || ".png", png);
vlb << Save Picture(drFolderSave || strPlotName || ".svg", svg);

I tried to change the size of the VListBox, but the VListBox insists that it has a size of {0,0}, which makes no sense since it contains a quite large picturebox. I tried to generate a FrameBox around it, but I only get error messages. I've looked for more documentation on that box, but I can only find documentation on the functions you can send to it, not how to generate one or when you should use it.

1 ACCEPTED SOLUTION

Accepted Solutions
Thierry_S
Super User

Re: Output picture size in pixels

Hi,
Have you tried to first capture the plots as an image (MyPict = vlb << Get Picture ()) and then use the MyPict << Set Size ({500, 300})?
Thierry R. Sornasse

View solution in original post

2 REPLIES 2
Thierry_S
Super User

Re: Output picture size in pixels

Hi,
Have you tried to first capture the plots as an image (MyPict = vlb << Get Picture ()) and then use the MyPict << Set Size ({500, 300})?
Thierry R. Sornasse
Ingerid
Level II

Re: Output picture size in pixels

Wow, that worked! Thank you so much!