Table of Contents

Method SaveSourceScreenshot

Namespace
OBSStudioClient
Assembly
OBSClient.dll

SaveSourceScreenshot(SourceRef, string, string, int?, int?, int?, Guid?, CancellationToken)

Saves a screenshot of a source to the filesystem.

public Task SaveSourceScreenshot(SourceRef source, string imageFormat, string imageFilePath, int? imageWidth = null, int? imageHeight = null, int? imageCompressionQuality = null, Guid? canvasUuid = null, CancellationToken cancellationToken = default)

Parameters

source SourceRef

The source to take a screenshot of, by name or by UUID.

imageFormat string

Image compression format to use. Use GetVersion to get compatible image formats.

imageFilePath string

Path to save the screenshot file to. Eg. C:\Users\user\Desktop\screenshot.png.

imageWidth int?

Width to scale the screenshot to. Restrictions: >= 8, <= 4096. If omitted: Source value is used.

imageHeight int?

Height to scale the screenshot to. Restrictions: >= 8, <= 4096. If omitted: Source value is used.

imageCompressionQuality int?

Compression quality to use. 0 for high compression, 100 for uncompressed. -1 to use "default" (whatever that means, idk) Restrictions: >= -1, <= 100. If omitted: -1.

canvasUuid Guid?

UUID of the canvas the source is in, if the source is given by name.

cancellationToken CancellationToken

A token that ends the wait for the response, which makes the method throw an OperationCanceledException. A request that was already sent is not undone: OBS Studio may still carry it out.

Returns

Task

Remarks

The imageWidth and imageHeight parameters are treated as "scale to inner", meaning the smallest ratio will be used and the aspect ratio of the original resolution is kept. If imageWidth and imageHeight are not specified, the compressed image will use the full resolution of the source.

**Compatible with inputs and scenes.**.