Width & Height Parameters

The width and height parameters control the viewport dimensions for capturing images.

Specifications

Width Parameter

PropertyValue
Typeinteger
RequiredNo
Default1440
Range1-5000
APIBoth HTML/CSS and Screenshot APIs

Height Parameter

PropertyValue
Typeinteger
RequiredNo
Default900
Range1-5000
APIBoth HTML/CSS and Screenshot APIs

Description

These parameters determine:

  • The viewport size for rendering content
  • The dimensions of the output image (unless fullpage is true)
  • The responsive breakpoint for the content

When using DPI values greater than 1, the actual rendered dimensions will be multiplied by the DPI value. For example:

  • With width=1920 and DPI=2, the final image will be 3840px wide
  • With height=1080 and DPI=2, the final image will be 2160px tall

To maintain specific output dimensions when using higher DPI:

  • Either divide your desired dimensions by the DPI value
  • Or omit width/height to let the image scale naturally with DPI

See the DPI parameter documentation for more details.

Examples

Basic Dimensions

{
    "html": "<div>Responsive Content</div>",
    "width": 1920,
    "height": 1080
}

Mobile Viewport

{
    "url": "https://example.com",
    "width": 375,
    "height": 667
}

Tablet Viewport with Custom Height

{
    "html": "<div>Tablet Content</div>",
    "width": 768,
    "height": 1024,
    "dpi": 2
}

Larger dimensions increase processing time and memory usage. For high-resolution images, consider using a smaller viewport with a higher DPI value instead of very large dimensions.

Common Viewport Sizes

Here are some common viewport sizes you might want to use:

DeviceWidthHeight
Desktop HD19201080
Desktop1440900
Laptop1366768
Tablet7681024
Mobile375667

When using responsive designs, make sure to test your content at different viewport sizes to ensure it renders correctly.