CreateImage Method


Creates an object that can be passed to DBView::setBackground function to set the background of the Image type.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since: 2014

Syntax

C#
public static ViewDisplayBackground CreateImage(
	string imagePath,
	ViewDisplayBackgroundImageFlags flags,
	UV imageOffsets,
	UV imageScales
)
Visual Basic
Public Shared Function CreateImage ( _
	imagePath As String, _
	flags As ViewDisplayBackgroundImageFlags, _
	imageOffsets As UV, _
	imageScales As UV _
) As ViewDisplayBackground
Visual C++
public:
static ViewDisplayBackground^ CreateImage(
	String^ imagePath, 
	ViewDisplayBackgroundImageFlags flags, 
	UV^ imageOffsets, 
	UV^ imageScales
)

Parameters

imagePath
Type: System String
File path with the image to be used.
flags
Type: Autodesk.Revit.DB ViewDisplayBackgroundImageFlags
Combination of flags (binary) that control how image is displayed in relation to the view/crop boundary.
imageOffsets
Type: Autodesk.Revit.DB UV
Horizontal (u) and vertical (v) offsets of the image.
imageScales
Type: Autodesk.Revit.DB UV
Horizontal (u) and vertical (v) scales of the image (1 == no change).

Return Value

New background object to pass to DBView::setBackground.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException The file specified by imagePath is not an image file. A valid image file should be in one of the following formats: bmp, jpg, jpeg, png, tif.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions ArgumentOutOfRangeException A value passed for an enumeration argument is not a member of that enumeration
Autodesk.Revit.Exceptions FileArgumentNotFoundException The file specified by imagePath doesn't exist.

See Also

ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →