SmallPict LogoSmallPict
Official Integration & SDK

Concurrent Production Pipeline for Go Microservices

Clean, idiomatic Go library for processing image uploads, user avatars, and media files in Gin, Fiber, Echo, or standard net/http services.

Install:go get github.com/smallpict/smallpict-go
GO Package

Implementation Example

go
package main

import (
	"context"
	"fmt"
	"os"
	"github.com/smallpict/smallpict-go"
)

func main() {
	client := smallpict.NewClient("sp_live_key_xxxxx")
	
	file, _ := os.Open("user_avatar.png")
	defer file.Close()

	result, err := client.Optimize(context.Background(), file, smallpict.Options{
		Format:  smallpict.FormatWebP,
		Quality: 82,
		Width:   400,
	})
	if err != nil {
		panic(err)
	}

	fmt.Printf("Optimized URL: %s | Size: %d bytes (-%d%%)\n", 
		result.URL, result.OptimizedSize, result.SavingsPercentage)
}

Integration Steps

11. go get package

Install the official Go module into your project.

22. Initialize client

Pass your SmallPict API Key to smallpict.NewClient().

33. Plug into upload handlers

Wrap user file uploads with client.Optimize() before saving to S3/R2.

Key Benefits

  • Context cancellation and timeout support
  • Memory-efficient io.Reader / io.Writer streaming
  • Connection pooling with HTTP/2 Keep-Alive
  • Native BYO-Storage destination headers
Official Developer Documentation

Need Complete Implementation Guides & API Specs?

Explore parameter references, authentication mechanisms, error codes, and local testing instructions in our official Golang SDK developer guide.

Read Golang SDK Docs

Supercharge Your Golang SDK Image Pipeline

Experience sub-50ms AVIF and WebP image optimization in your application. Zero setup fee, instant sandbox keys, and unlimited scalability.