No browser runtime to maintain
Keep the deployment as a small Go service instead of adding Chrome and a browser-controller process to the runtime.
HTML to WebP with GoLang
No browser management required
Render HTML and CSS from GoLang without installing Chrome, running chromedp or Rod, or building a separate image-storage pipeline.
GoLang workflow
Adjust the HTML and CSS here, then use the GoLang example below instead of recreating the browser-rendering workflow locally.
Managed rendering
Keep the application code focused on the request and response while HCTI manages Chromium, render isolation, retries, and hosted output.
Keep the deployment as a small Go service instead of adding Chrome and a browser-controller process to the runtime.
Use managed browser versions, isolated render jobs, built-in timing controls, and consistent viewport behavior across deployments.
Receive the hosted .webp result without building a separate pipeline for temporary files, uploads, storage, and delivery.
HTML to image API
POST the HTML, CSS, and format from GoLang. HCTI handles the browser lifecycle and returns the generated .webp URL.
Send complete markup and styles, including browser-supported fonts, images, SVG, and JavaScript.
Set format to webp and use the hosted .webp URL returned by the API.
Set viewport dimensions and device scale, or crop the result to a CSS selector.
Choose light or dark mode, timezone, and screen or print media.
How it works
Submit the content with format set to webp and any viewport or browser settings.
The API loads the markup, styles, fonts, and assets in a managed browser environment.
Embed the hosted result, download the file, or save it in your own storage and application records.
Output formats
Keep the same HTML and CSS. Choose lossless detail, compact compatibility, modern web delivery, or a paginated document.
Looking to capture a webpage as WebP? Explore URL to WebP in GoLangCrisp text, sharp UI details, and transparent backgrounds for designed graphics.
Explore PNGSmaller files and broad compatibility for photography, previews, and content-heavy pages.
Explore JPEGPaginated documents with page sizing, margins, backgrounds, and print styles.
Explore PDFExample code
Copy a complete GoLang request. Authentication, HTML, CSS, viewport settings, and response handling are shown together.
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"time"
)
func main() {
request := map[string]any{
"html": `
<div class="card">
<h1>Hello, world!</h1>
<p>Generated from HTML and CSS.</p>
</div>
`,
"css": `
.card {
width: 480px;
padding: 40px;
background: #f0fdf4;
color: #052e16;
font-family: sans-serif;
}
`,
"format": "webp",
}
body, err := json.Marshal(request)
if err != nil {
panic(err)
}
httpRequest, err := http.NewRequest(http.MethodPost, "https://hcti.io/v1/image", bytes.NewReader(body))
if err != nil {
panic(err)
}
httpRequest.SetBasicAuth(os.Getenv("HCTI_API_ID"), os.Getenv("HCTI_API_KEY"))
httpRequest.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 30 * time.Second}
response, err := client.Do(httpRequest)
if err != nil {
panic(err)
}
defer response.Body.Close()
responseBody, err := io.ReadAll(response.Body)
if err != nil {
panic(err)
}
if response.StatusCode >= http.StatusBadRequest {
panic(fmt.Sprintf("HCTI request failed (%d): %s", response.StatusCode, responseBody))
}
var result struct {
URL string `json:"url"`
}
if err := json.Unmarshal(responseBody, &result); err != nil {
panic(err)
}
fmt.Println(result.URL)
}
Ready to render?
Send HTML and CSS to the API and receive a hosted .webp image URL without running browser infrastructure.