Std ViewScreenShot: Difference between revisions

From FreeCAD Documentation
m (moved templates out of translation tags + link)
mNo edit summary
(15 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<translate>
<translate>

<!--T:18-->
{{Docnav
|[[Std_DlgParameter|DlgParameter]]
|[[Std_SceneInspector|SceneInspector]]
|[[Std_Tools_Menu|Std Tools Menu]]
|IconL=Std_DlgParameter.svg
|IconR=Std_SceneInspector.svg
|IconC=Freecad.svg
}}

<!--T:1-->
<!--T:1-->
{{GuiCommand
{{GuiCommand
|Name=Std ViewScreenShot
|Name=Std ViewScreenShot
|MenuLocation={{StdMenu|[[Std Tools Menu|Tools]]}} → Save picture...
|MenuLocation=Tools → Save picture...
|Workbenches=All
|Workbenches=All
|SeeAlso=[[Std_Print|Std Print]], [[Std_PrintPdf|Std PrintPdf]]
|SeeAlso=...
}}
}}


== Description == <!--T:2-->
==Description== <!--T:17-->
This command opens a dialog to save the current content of the [[3D view]] to a file. It can save to various image formats. Additionally, you can change the aspect ratio and the resolution of the screen shot using the "Options" button to get access to more parameters.


<!--T:3-->
<!--T:2-->
The '''Std ViewScreenShot''' command opens a dialog box to create an image file, a screenshot, from the active [[3D_view|3D view]].
This command can also use the image comment field of some image formats, like PNG or JPEG to save [[MIBA]] information along with the picture.

</translate>
[[Image:Save_picture.png|800px]]
<translate>
<!--T:19-->
{{Caption|The Save picture dialog box after pressing the Extended button}}


==Usage== <!--T:14-->
==Usage== <!--T:14-->


<!--T:15-->
<!--T:15-->
# Select the {{MenuCommand|Tools → [[Image:Std_ViewScreenShot.svg|16px]] Save picture...}} option from the menu.
# There are several ways to invoke this command:
# The Save picture dialog box opens.
#* Pressing the {{KEY|[[File:Std ViewScreenShot.svg|16px|Std ViewScreenShot|link=Std ViewScreenShot]] [[Std ViewScreenShot|Std ViewScreenShot]]}} button in the toolbar
# Optionally press the {{Button|Extended}} button to reveal an additional panel in the dialog box. For more information see [[#Options|Options]].
#* Using the {{MenuCommand|{{StdMenu|[[Std Tools Menu|Tools]]}} → Save picture...}} menu.
# Optionally browse to the correct folder.
#* via [[#Scripting|Python scripting]]
# Enter a filename and select the file type.
'''Result:''' A dialog will open requesting some parameters
# Press the {{Button|Save}} button to create the image file and close the dialog box.


==Options== <!--T:16-->
==Options== <!--T:16-->


===Image formats === <!--T:4-->
===Image dimensions=== <!--T:20-->
FreeCAD uses the QT built-in image types and some QT plugins in the bin/imageformats directory to save pictures. So how many and what formats you can choose depends on your platform.
=== Dialog ===


<!--T:5-->
<!--T:21-->
# Select a standard size from the '''Standard sizes''' dropdown list. Or specify the '''Width''' and '''Height''' for a custom size.
[[Image:Save_picture.png|550px]]
# Optionally press an '''Aspect ratio''' button to set the width-to-height ratio of the image. If the '''Width''' input box has the focus the height of the image will change and vice versa.


===== Image Size ===== <!--T:6-->
===Image properties=== <!--T:22-->
The image size parameters are set to the screen size of the active 3D view. But you can change it to any value you like. Some OpenGL drivers don't allow renderings greater then 8000 pixels. It depends on your system.


<!--T:7-->
<!--T:23-->
# Select an option from the '''Background''' dropdown list:
With the four buttons you can change the aspect to a certain value.
#* {{Value|Current}} This option uses the background of the 3D view.
#* {{Value|White}}
#* {{Value|Black}}
#* {{Value|Transparent}} Not all image formats support transparency.
# Select an option from the '''Creation method''' dropdown list:
#* {{Value|Offscreen (New)}} This is the default method. This method supports [https://en.wikipedia.org/wiki/Multisample_anti-aliasing anti-aliasing]. ''Technical information: The most important classes for this method are Qt's QOffscreenSurface and QOpenGLFramebufferObject.''
#* {{Value|Offscreen (Old)}} This method does not work on many modern Linux systems as it relies on the graphics driver. This method does not support anti-aliasing. ''Technical information: This is a real off-screen rendering method that only uses functions from the Coin3d library.''
#* {{Value|Framebuffer (custom)}} This method supports anti-aliasing. ''Technical information: If anti-aliasing is off, this method reads the image directly from the graphics renderer, else it renders to a framebuffer and gets the image from there. The key part of this method is Qt's QOpenGLFramebufferObject class.''
#* {{Value|Framebuffer (as is)}} This method uses the same techniques as '''Framebuffer (custom)'''. It also supports anti-aliasing but has some limitations related to custom sizes and always uses the current background of the 3D view.


===== Image background ===== <!--T:8-->
===Image comment=== <!--T:24-->
With this combo box you can choose the background of the picture you make.
* '''Current''' use the current view background (as chosen in the preferences)
* '''White''' creates a plain white background (for e.g. printings)
* '''Black''' plain black background
* '''Transparent''' creates a transparent background on image formats which support transparency


===== Creation method ===== <!--T:12-->
<!--T:25-->
# Select the {{RadioButton|TRUE|Insert MIBA}} option to add [[MIBA]] information to the file. Not all image formats support this.
With this combo box you can set how the image data is collected (rendered):
# Or select the {{RadioButton|TRUE|Insert comment}} option and type a comment in the text field to embed a comment in the file. Not all image formats support this.
* '''Framebuffer (custom)''': It uses the same technique as '''Framebuffer (as is)'''. Additionally it allows to set custom sizes and the background.
# Check the {{CheckBox|TRUE|Add watermark}} checkbox to add a watermark. The watermark is placed in the lower left corner of the image and consists of the FreeCAD logo and name above the main FreeCAD URL: [http://www.freecadweb.org www.freecadweb.org].
* '''Framebuffer (as is)''': If [https://en.wikipedia.org/wiki/Multisample_anti-aliasing multi-sampling anti-aliasing] is off, it reads the image directly from the graphic renderer. If multi-sampling is on, it renders to a framebuffer and gets the image from there. (The key part of this method is Qt's QOpenGLFramebufferObject class.)
* '''Offscreen (new)''': This is the default method. It is a replacement/alternative for the '''Offscreen (old)''' rendering. Additionally it supports multi-sampling. (The most important classes are Qt's QOffscreenSurface and QOpenGLFramebufferObject.)
* '''Offscreen (old)''': It only uses functions from the library Coin3d. This method does not support multi-sampling, relies heavily on graphic driver and on many modern Linux systems it does not work. It is a real off-screen rendering method that doesn't require an OpenGL window.


<!--T:13-->
==Notes== <!--T:26-->
To turn on multi-sampling (anti-aliasing), use the option '''[[Preferences_Editor#3D_View|Anti-Aliasing]]''' in the [[Preferences_Editor|preferences]].


===== Comment ===== <!--T:9-->
<!--T:27-->
* The number of available image file formats may vary depending on your OS.
Some image formats can embed a comment in to the picture. In case you choose one of this formats you can insert a comment or use the comment field for the '''[[MIBA]]''' information.
* Some OpenGL drivers don't allow renderings above a certain maximum size.

==Preferences== <!--T:28-->

<!--T:29-->
* The 3D view background can be changed in the preferences: {{MenuCommand|Edit → Preferences... → Display → Colors → Background color}}. See [[Preferences_Editor#Colors|Preferences Editor]].
* To change the 3D view anti-aliasing: {{MenuCommand|Edit → Preferences... → Display → 3D view → Rendering → Anti-Aliasing}}. See [[Preferences_Editor#3D_View|Preferences Editor]].

==Scripting== <!--T:30-->

<!--T:31-->
It is possible to create screenshots with python code.


== Scripting == <!--T:10-->
It's also possible to save the screen via python:
</translate>
</translate>
{{Code|code=
{{Code|code=
Line 67: Line 92:
}}
}}
<translate>
<translate>
<!--T:11-->
This script makes a series of pictures of different sizes and from different
points of view. The type of the camera, i.e. orthographic or perspective can also be changed.
</translate>


<!--T:32-->
This script saves a series of screenshots of different sizes and from different directions. The camera type, orthographic or perspective, is also changed.

</translate>
{{Code|code=
{{Code|code=
import Part,PartGui
import Part, PartGui
# loading test part
# Loading test part
Part.open("C:/Documents and Settings/jriegel/My Documents/Projects/FreeCAD/data/Blade.stp")
Part.open('C:/Documents and Settings/jriegel/My Documents/Projects/FreeCAD/data/Blade.stp')
OutDir = 'c:/temp/'
OutDir = 'C:/temp/'
# creating images with different Views, Cameras and sizes
# Creating images with different Views, Cameras and sizes
for p in ["PerspectiveCamera","OrthographicCamera"]:
for p in ['PerspectiveCamera','OrthographicCamera']:
Gui.SendMsgToActiveView(p)
Gui.SendMsgToActiveView(p)
for f in ["ViewAxo","ViewFront","ViewTop"]:
for f in ['ViewAxo','ViewFront','ViewTop']:
Gui.SendMsgToActiveView(f)
Gui.SendMsgToActiveView(f)
for x,y in [[500,500],[1000,3000],[3000,1000],[3000,3000],[8000,8000]]:
for x,y in [[500,500],[1000,3000],[3000,1000],[3000,3000],[8000,8000]]:
Gui.ActiveDocument.ActiveView.saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".jpg",x,y,"White")
Gui.ActiveDocument.ActiveView.saveImage(OutDir + 'Blade_' + p +'_' + f + '_' + `x` + '_' + `y` + '.jpg',x,y,'White')
Gui.ActiveDocument.ActiveView.saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".png",x,y,"Transparent")
Gui.ActiveDocument.ActiveView.saveImage(OutDir + 'Blade_' + p +'_' + f + '_' + `x` + '_' + `y` + '.png',x,y,'Transparent')


# close active document
# Close active document
App.closeDocument(App.ActiveDocument.Name)
App.closeDocument(App.ActiveDocument.Name)
}}
}}
<translate>


{{clear}}


<!--T:33-->
{{Std Base navi{{#translation:}}}} <!--Do not add this line inside of translation tags -->
{{Docnav
|[[Std_DlgParameter|DlgParameter]]
|[[Std_SceneInspector|SceneInspector]]
|[[Std_Tools_Menu|Std Tools Menu]]
|IconL=Std_DlgParameter.svg
|IconR=Std_SceneInspector.svg
|IconC=Freecad.svg
}}


</translate>
{{Userdocnavi{{#translation:}}}} <!--Do not add this line inside of translation tags -->
{{Std Base navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{clear}}

Revision as of 15:43, 29 December 2020

Std ViewScreenShot

Menu location
Tools → Save picture...
Workbenches
All
Default shortcut
None
Introduced in version
-
See also
Std Print, Std PrintPdf

Description

The Std ViewScreenShot command opens a dialog box to create an image file, a screenshot, from the active 3D view.

The Save picture dialog box after pressing the Extended button

Usage

  1. Select the Tools → Save picture... option from the menu.
  2. The Save picture dialog box opens.
  3. Optionally press the Extended button to reveal an additional panel in the dialog box. For more information see Options.
  4. Optionally browse to the correct folder.
  5. Enter a filename and select the file type.
  6. Press the Save button to create the image file and close the dialog box.

Options

Image dimensions

  1. Select a standard size from the Standard sizes dropdown list. Or specify the Width and Height for a custom size.
  2. Optionally press an Aspect ratio button to set the width-to-height ratio of the image. If the Width input box has the focus the height of the image will change and vice versa.

Image properties

  1. Select an option from the Background dropdown list:
    • Current This option uses the background of the 3D view.
    • White
    • Black
    • Transparent Not all image formats support transparency.
  2. Select an option from the Creation method dropdown list:
    • Offscreen (New) This is the default method. This method supports anti-aliasing. Technical information: The most important classes for this method are Qt's QOffscreenSurface and QOpenGLFramebufferObject.
    • Offscreen (Old) This method does not work on many modern Linux systems as it relies on the graphics driver. This method does not support anti-aliasing. Technical information: This is a real off-screen rendering method that only uses functions from the Coin3d library.
    • Framebuffer (custom) This method supports anti-aliasing. Technical information: If anti-aliasing is off, this method reads the image directly from the graphics renderer, else it renders to a framebuffer and gets the image from there. The key part of this method is Qt's QOpenGLFramebufferObject class.
    • Framebuffer (as is) This method uses the same techniques as Framebuffer (custom). It also supports anti-aliasing but has some limitations related to custom sizes and always uses the current background of the 3D view.

Image comment

  1. Select the Insert MIBA option to add MIBA information to the file. Not all image formats support this.
  2. Or select the Insert comment option and type a comment in the text field to embed a comment in the file. Not all image formats support this.
  3. Check the Add watermark checkbox to add a watermark. The watermark is placed in the lower left corner of the image and consists of the FreeCAD logo and name above the main FreeCAD URL: www.freecadweb.org.

Notes

  • The number of available image file formats may vary depending on your OS.
  • Some OpenGL drivers don't allow renderings above a certain maximum size.

Preferences

  • The 3D view background can be changed in the preferences: Edit → Preferences... → Display → Colors → Background color. See Preferences Editor.
  • To change the 3D view anti-aliasing: Edit → Preferences... → Display → 3D view → Rendering → Anti-Aliasing. See Preferences Editor.

Scripting

It is possible to create screenshots with python code.

Gui.ActiveDocument.ActiveView.saveImage('C:/temp/test.png',1656,783,'Current')

This script saves a series of screenshots of different sizes and from different directions. The camera type, orthographic or perspective, is also changed.

import Part, PartGui
# Loading test part
Part.open('C:/Documents and Settings/jriegel/My Documents/Projects/FreeCAD/data/Blade.stp')
OutDir = 'C:/temp/'
 
# Creating images with different Views, Cameras and sizes
for p in ['PerspectiveCamera','OrthographicCamera']:
    Gui.SendMsgToActiveView(p)
    for f in ['ViewAxo','ViewFront','ViewTop']:
        Gui.SendMsgToActiveView(f)
        for x,y in [[500,500],[1000,3000],[3000,1000],[3000,3000],[8000,8000]]:
            Gui.ActiveDocument.ActiveView.saveImage(OutDir + 'Blade_' + p +'_' + f + '_' + `x` + '_' + `y` + '.jpg',x,y,'White')
            Gui.ActiveDocument.ActiveView.saveImage(OutDir + 'Blade_' + p +'_' + f + '_' + `x` + '_' + `y` + '.png',x,y,'Transparent')

# Close active document
App.closeDocument(App.ActiveDocument.Name)