# Set image size limits This article shows how to set output image size limits when rendering image to HTML The [HtmlViewOptions](https://reference.groupdocs.com/net/viewer/groupdocs.viewer.options/htmlviewoptions) class has the following properties to set the image width or/and height: {{< tabs "html-image-size-properties">}} {{< tab "C#" >}} ```csharp /// /// Max width of an output image in pixels. /// public int ImageMaxWidth { get; set; } /// /// Max height of an output image in pixels. /// public int ImageMaxHeight { get; set; } /// /// The width of the output image in pixels. /// public int ImageWidth { get; set; } /// /// The height of an output image in pixels. /// public int ImageHeight { get; set; } ``` {{< /tab >}} {{< tab "VB.NET">}} ```vb Class SurroundingClass ''' ''' Max width of an output image in pixels. ''' Public Property ImageMaxWidth As Integer ''' ''' Max height of an output image in pixels. ''' Public Property ImageMaxHeight As Integer ''' ''' The width of the output image in pixels. ''' Public Property ImageWidth As Integer ''' ''' The height of an output image in pixels. ''' Public Property ImageHeight As Integer End Class ``` {{< /tab >}} {{< /tabs >}} You can set the width and/or height of the output images. Use one of the following methods: * To render a single image, set ImageWidth/ImageHeight options. * To render multiple images, set ImageMaxWidth/ImageMaxHeight options. If an image exceeds these limits, it is resized proportionally. {{< alert style="warning" >}} If you set the ImageWidth/ImageHeight options, the ImageMaxWidth/ImageMaxHeight options are ignored. {{< /alert >}} To set the ImageMaxWidth/ImageMaxHeight options, follow these steps: 1. Instantiate the [Viewer](https://reference.groupdocs.com/net/viewer/groupdocs.viewer/viewer) object. 2. Instantiate the [HtmlViewOptions](https://reference.groupdocs.com/net/viewer/groupdocs.viewer.options/htmlviewoptions) object. 3. Set the ImageMaxWidth and/or ImageMaxHeight values; 4. Call the [View](https://reference.groupdocs.com/net/viewer/groupdocs.viewer/viewer/methods/view) method. The following code snippet shows how to set the output image size limits: {{< tabs "limit-image-size-in-html">}} {{< tab "C#" >}} ```csharp using GroupDocs.Viewer; using GroupDocs.Viewer.Options; // ... using (Viewer viewer = new Viewer("sample.jpeg")) { // Create view options. var viewOptions = HtmlViewOptions.ForEmbeddedResources(); // Specify the maximum width and height. viewOptions.ImageMaxWidth = 800; viewOptions.ImageMaxHeight = 600; viewer.View(viewOptions); } ``` {{< /tab >}} {{< tab "VB.NET">}} ```vb Imports GroupDocs.Viewer Imports GroupDocs.Viewer.Options ' ... Module Program Sub Main(args As String()) Using viewer As Viewer = New Viewer("sample.jpeg") ' Create view options. Dim viewOptions = HtmlViewOptions.ForEmbeddedResources() ' Specify the maximum width and height. viewOptions.ImageMaxWidth = 800 viewOptions.ImageMaxHeight = 600 viewer.View(viewOptions) End Using End Sub End Module ``` {{< /tab >}} {{< tab "sample.jpeg" >}} {{< tab-text >}} `sample.jpeg` is the sample file used in this example. Click [here](https://docs.groupdocs.com/viewer/net/_sample_files/developer-guide/rendering-documents/rendering-to-html/set-image-size-limits-when-rendering-to-html/sample.jpeg) to download it. {{< /tab-text >}} {{< /tab >}} {{< tab "p_1.html" >}} ```text HTML file (124 KB) ``` [Download full output](https://docs.groupdocs.com/viewer/net/_output_files/developer-guide/rendering-documents/rendering-to-html/set-image-size-limits-when-rendering-to-html/LimitImageSizeInHtml/p_1.html) {{< /tab >}} {{< /tabs >}}