Packages
Search packages... ⌘K
Go Package
webassets
Image processing pipeline — resize, optimize, format conversion via sips/ImageMagick
Go Ready SI
Image Processing Pipeline
$ proc := webassets.NewProcessor(store)
[webassets] backend: sips (macOS)
$ proc.Resize(ctx, "hero.jpg", 1920, 1080)
[resize] hero.jpg 3840x2160 -> 1920x1080
[resize] hero_1920x1080.jpg — 487 KB
$ proc.Convert(ctx, "hero_1920x1080.jpg", webassets.WebP)
[convert] jpg -> webp (quality: 85)
[convert] hero_1920x1080.webp — 198 KB (59% reduction)
$ proc.Optimize(ctx, "hero_1920x1080.webp", 80)
[optimize] 198 KB -> 162 KB (18% reduction)
About
Processes web images through a configurable pipeline: resize to target dimensions, optimize file size, and convert between formats. Uses macOS sips for local development and ImageMagick for production containers.
Public API
| Name | Kind | Signature |
|---|---|---|
| Processor | type | type Processor struct |
| NewProcessor | func | func NewProcessor(store *storage.Client, opts ...ProcessorOption) *Processor |
| Resize | func | func (p *Processor) Resize(ctx context.Context, src string, width, height int) (string, error) |
| Optimize | func | func (p *Processor) Optimize(ctx context.Context, src string, quality int) (string, error) |
| Convert | func | func (p *Processor) Convert(ctx context.Context, src string, format Format) (string, error) |
Dependencies
Imports (2)
external Go Ready
External process runner — exec.Command wrapper with timeout, output capture, error handling
execprocess-runnertimeoutoutput-capture
5 exports 7 deps
storage Go Ready
R2-compatible object storage — upload, download, presigned URLs
r2s3-compatibleobject-storagepresigned-urls
5 exports 3 deps
Related Packages
storage Go Ready
R2-compatible object storage — upload, download, presigned URLs
r2s3-compatibleobject-storagepresigned-urls
5 exports 3 deps
pdf Go Ready
PDF generation — HTML-to-PDF rendering with template support
pdfhtml-to-pdftemplatesrendering
4 exports 1 deps
external Go Ready
External process runner — exec.Command wrapper with timeout, output capture, error handling
execprocess-runnertimeoutoutput-capture
5 exports 7 deps
Source
github.com/shredbx/sbx-core/pkg/webassets
imagesresizeoptimizationsipsimagemagick