Skip to content

Commit 18f9681

Browse files
committed
improve file formats
1 parent bd86647 commit 18f9681

File tree

1 file changed

+96
-16
lines changed

1 file changed

+96
-16
lines changed

guides/file-formats.md

Lines changed: 96 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,114 @@ permalink: /guides/file-formats/
55
parent: Guides
66
nav_order: 2
77
description: >-
8-
HTML/CSS to Image supports converting html into png, jpg or webp. Learn how to specify the format of your image.
8+
Learn about supported image formats (PNG, JPG, WebP) and how to optimize your image delivery.
99
---
10-
# File formats
10+
11+
# Image File Formats
1112
{: .no_toc }
1213
{: .fs-9 }
1314

14-
Convert images from HTML to jpg, png or webp.
15+
Choose the right format for your use case
1516
{: .fs-6 .fw-300 }
1617

1718
<hr>
1819

19-
## File formats
20+
Table of contents
21+
{: .text-delta }
22+
- TOC
23+
{:toc}
24+
25+
<hr>
26+
27+
## Supported Formats
28+
29+
The API supports three image formats:
30+
- PNG (default)
31+
- JPG
32+
- WebP
33+
34+
To specify a format, add the appropriate file extension to your image URL:
35+
36+
| Format | Example URL | Best For |
37+
|:-------|:------------|:---------|
38+
| PNG | `https://hcti.io/v1/image/abc123.png` | Screenshots, images with transparency |
39+
| JPG | `https://hcti.io/v1/image/abc123.jpg` | Photos, complex images with no transparency |
40+
| WebP | `https://hcti.io/v1/image/abc123.webp` | Modern web applications, optimal compression |
41+
42+
{% include hint.md title="Default Format" text="If no extension is specified, the API will return a PNG image." %}
43+
44+
## Format Characteristics
45+
46+
### PNG
47+
- Lossless compression
48+
- Supports transparency
49+
- Larger file size
50+
- Best for:
51+
- Screenshots
52+
- Images with text
53+
- Graphics with sharp edges
54+
- Content requiring transparency
55+
56+
### JPG
57+
- Lossy compression
58+
- No transparency support
59+
- Smaller file size
60+
- Best for:
61+
- Photographs
62+
- Complex images
63+
- When transparency isn't needed
64+
- When smaller file size is priority
65+
66+
### WebP
67+
- Modern format
68+
- Supports transparency
69+
- Superior compression
70+
- Best for:
71+
- Web applications
72+
- Progressive loading
73+
- Optimal performance
74+
- Modern browsers
75+
76+
## Automatic WebP Optimization
77+
78+
All paid accounts receive automatic WebP optimization:
79+
80+
1. Our edge servers detect the user's browser capabilities
81+
2. If WebP is supported, images are automatically served in WebP format
82+
3. Fallback formats are served for non-supporting browsers
2083

21-
The API supports `jpg`, `png` and `webp`. If no file extension is passed, you'll get back a png by default. If you need a different file format, adjust the extension on the url.
84+
Benefits:
85+
- Improved page load times
86+
- Better SEO scores
87+
- Reduced bandwidth usage
88+
- No code changes required
2289

23-
| **Format** | **Example** |
24-
| :--- | :--- |
25-
| jpg | `https://hcti.io/v1/image/a3ab2ab2-906e-4b5c-a88d-41a1c3f3779e.jpg` |
26-
| png | `https://hcti.io/v1/image/a3ab2ab2-906e-4b5c-a88d-41a1c3f3779e.png` |
27-
| webp | `https://hcti.io/v1/image/a3ab2ab2-906e-4b5c-a88d-41a1c3f3779e.webp` |
90+
{% include hint.md title="Performance Tip" text="WebP typically provides 25-35% smaller file sizes compared to PNG/JPG while maintaining visual quality." %}
2891

29-
## Automatic next-gen format (WebP) - enabled for all customers
92+
## Best Practices
3093

31-
It's [recommend by Google to serve your images](https://web.dev/uses-webp-images/) in next-gen formats (such as WebP).
94+
### Format Selection
95+
1. **Default to PNG** for:
96+
- Screenshots
97+
- Text-heavy images
98+
- When quality is critical
99+
100+
2. **Use JPG** for:
101+
- Photos
102+
- Complex images
103+
- When file size is priority
104+
105+
3. **Enable WebP** for:
106+
- Modern web applications
107+
- Performance optimization
108+
- Progressive enhancement
32109

33-
- Improves your pagespeed
34-
- Increases SEO
110+
## Browser Support
35111

36-
Our edge servers will detect the browser being used to download an image. If the browser supports WebP, the image will be served in WebP.
112+
| Format | Chrome | Firefox | Safari | Edge | IE11 |
113+
|:-------|:-------|:--------|:-------|:-----|:-----|
114+
| PNG ||||||
115+
| JPG ||||||
116+
| WebP ||||||
37117

38-
- This is enabled for all paid customers.
118+
{% include code_footer.md version=1 %}

0 commit comments

Comments
 (0)