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
sourceSourceRefThe source to take a screenshot of, by name or by UUID.
imageFormatstringImage compression format to use. Use
GetVersionto get compatible image formats.imageFilePathstringPath to save the screenshot file to. Eg.
C:\Users\user\Desktop\screenshot.png.imageWidthint?Width to scale the screenshot to. Restrictions: >= 8, <= 4096. If omitted: Source value is used.
imageHeightint?Height to scale the screenshot to. Restrictions: >= 8, <= 4096. If omitted: Source value is used.
imageCompressionQualityint?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.
canvasUuidGuid?UUID of the canvas the source is in, if the source is given by name.
cancellationTokenCancellationTokenA 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
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.**.