Table of Contents

Method FitImageInViewportInPixels

Namespace
Terminal.Gui.Views
Assembly
Terminal.Gui.dll

FitImageInViewportInPixels(Size)

Scales an image to fit within the current Viewport while maintaining aspect ratio.

public Size FitImageInViewportInPixels(Size imageSize)

Parameters

imageSize Size

The original size of the image to scale.

Returns

Size

The scaled size of the image that fits within the Viewport.

Remarks

This method calculates the largest possible size for the given image that will fit within the current Viewport while maintaining its aspect ratio.

The calculation is based on the terminal's cell resolution and the Viewport size, returning the exact pixel dimensions and position required for the scaled image.