Skip to main content
Screenshotly lets you set exact viewport dimensions and emulate device characteristics like screen density, touch support, and orientation.

Setting viewport dimensions

Use width and height to define the browser viewport size in pixels:
const screenshot = await client.capture({
  url: 'https://example.com',
  width: 1440,
  height: 900
});
Default values are 1920x1080 when not specified.

Device emulation parameters

ParameterTypeDefaultDescription
widthinteger1920Viewport width in pixels
heightinteger1080Viewport height in pixels
deviceScaleFactornumber1Device pixel ratio (2 for retina)
isMobilebooleanfalseEmulate mobile device behavior
hasTouchbooleanfalseEnable touch event support
isLandscapebooleanfalseUse landscape orientation

Common device presets

Here are viewport settings for popular devices:
DeviceWidthHeightScale factorMobile
iPhone 143908443true
iPhone SE3756672true
iPad Air82011802true
iPad Mini (landscape)10247682true
Pixel 74129152.625true
MacBook Pro 14”15129822false
Desktop 1080p192010801false

Examples

Mobile device

const screenshot = await client.capture({
  url: 'https://example.com',
  width: 390,
  height: 844,
  deviceScaleFactor: 3,
  isMobile: true,
  hasTouch: true
});

Tablet in landscape

const screenshot = await client.capture({
  url: 'https://example.com',
  width: 1024,
  height: 768,
  deviceScaleFactor: 2,
  isMobile: true,
  hasTouch: true,
  isLandscape: true
});

Retina desktop

const screenshot = await client.capture({
  url: 'https://example.com',
  width: 1440,
  height: 900,
  deviceScaleFactor: 2
});
Combine viewport settings with fullPage: true to capture the entire page at a specific device width. The width controls how the page renders responsively, while full-page captures the complete scrollable height.

Testing responsive breakpoints

To test your site across multiple breakpoints, use batch processing with different viewport settings, or loop through common widths:
const breakpoints = [375, 768, 1024, 1440, 1920];

for (const width of breakpoints) {
  const screenshot = await client.capture({
    url: 'https://example.com',
    width,
    height: 800,
    fullPage: true
  });
  console.log(`Captured at ${width}px:`, screenshot.data.imageUrl);
}