Go · HTML to Image
Convert HTML to Image in Go
Use Go's standard net/http package to call renderpix. Zero CGo, no native dependencies — works in Alpine containers, Lambda, Cloud Run, anywhere Go runs.
Gorenderpix API example
package main import ( "bytes" "encoding/json" "io" "net/http" "os" ) func htmlToImage(html string) ([]byte, error) { body, _ := json.Marshal(map[string]any{ "html": html, "width": 800, "height": 400, "format": "png", }) req, _ := http.NewRequest("POST", "https://renderpix.dev/v1/render", bytes.NewReader(body)) req.Header.Set("X-API-Key", "rpx_your_key") req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { return nil, err } defer res.Body.Close() return io.ReadAll(res.Body) } func main() { img, _ := htmlToImage(`<div style="padding:40px;background:#0f172a;color:white">Hello!</div>`) os.WriteFile("out.png", img, 0644) }
Common use cases
High-throughput
Generate images at scale from Go microservices.
Cloud Run
Deploy zero-dependency image services with Go.
gRPC gateways
Add image generation to existing gRPC API layers.
CLI tools
Build developer tools that export HTML reports as images.
Start converting HTML to images for free
100 free renders/month. No credit card. Set up in 2 minutes.
Get free API key