DomShot supports three image formats. Choose based on your use case: lossless quality (PNG), smaller file size (JPEG/WebP), or modern web optimization (WebP).
| Format | Compression | Quality Parameter | Transparency | Best For |
|---|
| PNG | Lossless | No | Yes | Text, UI, documentation |
| JPEG | Lossy | Yes (1-100) | No | Photographs, complex images |
| WebP | Lossy | Yes (1-100) | Yes | Web applications, storage |
PNG
Lossless compression with perfect quality. Best for screenshots containing text, UI elements, or when you need transparency.
curl "https://api.domshot.com/shot?key=YOUR_API_KEY&url=https://example.com&format=png" \
--output screenshot.png
const params = new URLSearchParams({
key: 'YOUR_API_KEY',
url: 'https://example.com',
format: 'png'
});
await fetch(`https://api.domshot.com/shot?${params}`)
.then(res => res.blob())
.then(blob => fs.writeFile('screenshot.png', blob));
$params = [
'key' => 'YOUR_API_KEY',
'url' => 'https://example.com',
'format' => 'png'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.domshot.com/shot?' . http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$result = curl_exec($ch);
file_put_contents('screenshot.png', $result);
curl_close($ch);
package main
import (
"net/http"
"net/url"
)
func main() {
params := url.Values{}
params.Set("key", "YOUR_API_KEY")
params.Set("url", "https://example.com")
params.Set("format", "png")
resp, _ := http.Get("https://api.domshot.com/shot?" + params.Encode())
defer resp.Body.Close()
// Save response to file
}
Characteristics:
- Largest file size
- No quality loss
- Supports transparency
- Universal compatibility
JPEG
Lossy compression optimized for photographic content. Smaller files with adjustable quality.
curl "https://api.domshot.com/shot?key=YOUR_API_KEY&url=https://example.com&format=jpeg&quality=80" \
--output screenshot.jpg
const params = new URLSearchParams({
key: 'YOUR_API_KEY',
url: 'https://example.com',
format: 'jpeg',
quality: '80'
});
await fetch(`https://api.domshot.com/shot?${params}`)
.then(res => res.blob())
.then(blob => fs.writeFile('screenshot.jpg', blob));
$params = [
'key' => 'YOUR_API_KEY',
'url' => 'https://example.com',
'format' => 'jpeg',
'quality' => '80'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.domshot.com/shot?' . http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$result = curl_exec($ch);
file_put_contents('screenshot.jpg', $result);
curl_close($ch);
package main
import (
"net/http"
"net/url"
)
func main() {
params := url.Values{}
params.Set("key", "YOUR_API_KEY")
params.Set("url", "https://example.com")
params.Set("format", "jpeg")
params.Set("quality", "80")
resp, _ := http.Get("https://api.domshot.com/shot?" + params.Encode())
defer resp.Body.Close()
// Save response to file
}
Characteristics:
- Smaller file size than PNG
- Adjustable quality (1-100, default: 100)
- No transparency support
- Best for photos and complex graphics
WebP
Modern format with excellent compression ratio. Ideal for web applications and storage optimization.
curl "https://api.domshot.com/shot?key=YOUR_API_KEY&url=https://example.com&format=webp&quality=80" \
--output screenshot.webp
const params = new URLSearchParams({
key: 'YOUR_API_KEY',
url: 'https://example.com',
format: 'webp',
quality: '80'
});
await fetch(`https://api.domshot.com/shot?${params}`)
.then(res => res.blob())
.then(blob => fs.writeFile('screenshot.webp', blob));
$params = [
'key' => 'YOUR_API_KEY',
'url' => 'https://example.com',
'format' => 'webp',
'quality' => '80'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.domshot.com/shot?' . http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$result = curl_exec($ch);
file_put_contents('screenshot.webp', $result);
curl_close($ch);
package main
import (
"net/http"
"net/url"
)
func main() {
params := url.Values{}
params.Set("key", "YOUR_API_KEY")
params.Set("url", "https://example.com")
params.Set("format", "webp")
params.Set("quality", "80")
resp, _ := http.Get("https://api.domshot.com/shot?" + params.Encode())
defer resp.Body.Close()
// Save response to file
}
Characteristics:
- Best compression ratio
- Adjustable quality (1-100, default: 100)
- Supports transparency
- Modern browser support
Quality parameter
The quality parameter controls compression for JPEG and WebP formats:
| Value | Description |
|---|
1-49 | Low quality, smallest files |
50-79 | Good balance of quality and size |
80-100 | High quality, larger files (default: 100) |
Quality settings do not apply to PNG format since it uses lossless compression.
Recommendations
Choose your format based on your primary need:
| Use case | Format | Reason |
|---|
| Documentation, tutorials | PNG | Sharp text, universal support |
| Social media thumbnails | JPEG | Small file size, wide compatibility |
| Web applications | WebP | Best compression, modern standard |
| Archiving | PNG | Lossless quality for long-term storage |
| Email attachments | JPEG | Smaller files, faster loading |
Parameters
| Parameter | Type | Default | Description |
|---|
format | string | png | png, jpeg, or webp |
quality | number | 100 | Image quality from 1-100 (JPEG/WebP only) |
See also