Versions in this module Expand all Collapse all v1 v1.2.1 Nov 16, 2026 v1.2.0 Nov 16, 2026 Changes in this version type Client + func (c *Client) Preset(ctx context.Context, name string) (string, error) type Image + Barcodes []Barcode + Text []string + TextTruncated bool v1.1.0 Nov 16, 2026 Changes in this version type RemoveBackgroundOptions + Studio bool v1.0.0 Nov 13, 2026 Changes in this version + const CodeAccountSuspended + const CodeBadRequest + const CodeBusy + const CodeInputUnavailable + const CodeInternal + const CodeModelUnavailable + const CodeNotFound + const CodePayloadTooLarge + const CodePaymentRequired + const CodeUnauthorized + const CodeUnprocessable + const CodeUnsupportedFormat + const DefaultBaseURL + const DefaultRetries + const DefaultTimeout + const DefaultWaitInterval + const DefaultWaitTimeout + const DefaultWebhookTolerance + const EventJobCompleted + const FitContain + const FitCover + const FitFill + const FormatAVIF + const FormatJPEG + const FormatPNG + const FormatWebP + const HealthFailed + const HealthLoading + const HealthOK + const ItemDone + const ItemFailed + const ItemPending + const JobCompleted + const JobQueued + const JobRunning + const MaxImagesPerRequest + const OperationBlurFaces + const OperationCaption + const OperationCheck + const OperationColorize + const OperationCrop + const OperationDenoise + const OperationEnhance + const OperationExpand + const OperationFindFaces + const OperationFix + const OperationIDPhoto + const OperationPalette + const OperationReadBarcodes + const OperationReadLabel + const OperationReadText + const OperationRemoveBackground + const OperationRemoveText + const OperationResize + const OperationRestoreFaces + const OperationRun + const OperationSelect + const OperationUpscale + const OperationVectorize + const OperationWatermark + const RegionAll + const RegionBackground + const SignatureHeader + const Version + var ErrAccountSuspended error = &Error + var ErrBadRequest error = &Error + var ErrBusy error = &Error + var ErrInternal error = &Error + var ErrMissingAPIKey = errors.New("photos: no API key: pass one to New or set PHOTOS_API_KEY") + var ErrMissingResultHeaders = errors.New("photos: the job item result lacks the headers") + var ErrModelUnavailable error = &Error + var ErrNotFound error = &Error + var ErrPayloadTooLarge error = &Error + var ErrPaymentRequired error = &Error + var ErrUnauthorized error = &Error + var ErrUnprocessable error = &Error + var ErrUnsupportedFormat error = &Error + var ErrWaitTimeout = errors.New("photos: timed out waiting for the job") + var ErrWebhookHeader error = &WebhookError + var ErrWebhookPayload error = &WebhookError + var ErrWebhookSignature error = &WebhookError + var ErrWebhookTimestamp error = &WebhookError + func Bool(v bool) *bool + func Float(v float64) *float64 + func Int(v int) *int + type Account struct + Account string + Credits *int64 + Key string + Prices map[string]int64 + Raw json.RawMessage + Unlimited bool + func (a *Account) UnmarshalJSON(data []byte) (err error) + type Barcode struct + Format string + GS1 *string + Value string + type BarcodesResult struct + Barcodes []Barcode + Raw json.RawMessage + Variant string + func (r *BarcodesResult) UnmarshalJSON(data []byte) (err error) + type BlurFacesOptions struct + Color string + Format string + MinScore float64 + Mode string + Padding *float64 + Quality int + Strength float64 + type BlurFacesResult struct + Faces int + type Border struct + Cast []float64 + Mean []float64 + White float64 + type Candidate struct + Evidence []string + ProductID string + Score float64 + Title string + type CaptionOptions struct + Detail string + type CaptionResult struct + Caption string + Detail string + Height int + Raw json.RawMessage + Width int + func (r *CaptionResult) UnmarshalJSON(data []byte) (err error) + type CheckOptions struct + Marketplace string + Subject bool + Text bool + type CheckResult struct + Findings []Finding + Marketplace *Verdict + Metrics Metrics + Ms map[string]int64 + Raw json.RawMessage + Text []FoundText + func (r *CheckResult) UnmarshalJSON(data []byte) (err error) + type Client struct + Jobs *JobsService + func New(apiKey string, opts ...Option) (*Client, error) + func (c *Client) Account(ctx context.Context) (*Account, error) + func (c *Client) BlurFaces(ctx context.Context, image Input, opts *BlurFacesOptions) (*BlurFacesResult, error) + func (c *Client) Caption(ctx context.Context, image Input, opts *CaptionOptions) (*CaptionResult, error) + func (c *Client) Check(ctx context.Context, image Input, opts *CheckOptions) (*CheckResult, error) + func (c *Client) Colorize(ctx context.Context, image Input, opts *ColorizeOptions) (*Image, error) + func (c *Client) Crop(ctx context.Context, image Input, opts *CropOptions) (*Image, error) + func (c *Client) Denoise(ctx context.Context, image Input, opts *DenoiseOptions) (*Image, error) + func (c *Client) Enhance(ctx context.Context, image Input, opts *EnhanceOptions) (*Image, error) + func (c *Client) Erase(ctx context.Context, image Input, opts *EraseOptions) (*Image, error) + func (c *Client) Expand(ctx context.Context, image Input, opts *ExpandOptions) (*Image, error) + func (c *Client) FindFaces(ctx context.Context, image Input, opts *FindFacesOptions) (*FacesResult, error) + func (c *Client) Fix(ctx context.Context, image Input, marketplace string) (*FixResult, error) + func (c *Client) Health(ctx context.Context) (string, error) + func (c *Client) IDPhoto(ctx context.Context, image Input, opts *IDPhotoOptions) (*IDPhotoResult, error) + func (c *Client) IDPhotos(ctx context.Context) ([]IDPhotoDocument, error) + func (c *Client) Identify(ctx context.Context, images []Input, opts *IdentifyOptions) (*IdentifyResult, error) + func (c *Client) Marketplaces(ctx context.Context) ([]Marketplace, error) + func (c *Client) Palette(ctx context.Context, image Input, opts *PaletteOptions) (*PaletteResult, error) + func (c *Client) Presets(ctx context.Context) ([]Preset, error) + func (c *Client) ReadBarcodes(ctx context.Context, image Input, opts *ReadBarcodesOptions) (*BarcodesResult, error) + func (c *Client) ReadLabel(ctx context.Context, images []Input) (*LabelResult, error) + func (c *Client) ReadText(ctx context.Context, image Input) (*TextResult, error) + func (c *Client) RemoveBackground(ctx context.Context, image Input, opts *RemoveBackgroundOptions) (*Image, error) + func (c *Client) RemoveText(ctx context.Context, image Input, opts *RemoveTextOptions) (*RemoveTextResult, error) + func (c *Client) Resize(ctx context.Context, image Input, opts *ResizeOptions) (*Image, error) + func (c *Client) RestoreFaces(ctx context.Context, image Input, opts *RestoreFacesOptions) (*RestoreFacesResult, error) + func (c *Client) Run(ctx context.Context, image Input, opts *RunOptions) (*Image, error) + func (c *Client) Select(ctx context.Context, image Input, opts *SelectOptions) (*SelectResult, error) + func (c *Client) Upscale(ctx context.Context, image Input, opts *UpscaleOptions) (*Image, error) + func (c *Client) Vectorize(ctx context.Context, image Input, opts *VectorizeOptions) (*VectorizeResult, error) + func (c *Client) Watermark(ctx context.Context, image Input, opts *WatermarkOptions) (*Image, error) + func (c *Client) WebhookSecret(ctx context.Context) (*WebhookSecret, error) + type ColorizeOptions struct + Format string + Quality int + Strength float64 + type ConnectionError struct + Err error + Timeout bool + func (e *ConnectionError) Error() string + func (e *ConnectionError) Unwrap() error + type CropOptions struct + Aspect string + Focus string + Format string + Height int + Padding *float64 + Quality int + Width int + Zoom bool + type DenoiseOptions struct + Format string + Quality int + Strength float64 + type EnhanceOptions struct + Auto *bool + Brightness float64 + Contrast float64 + Format string + Levels *bool + Quality int + Saturation float64 + Sharpen float64 + Temperature float64 + WhiteBalance *bool + type EraseOptions struct + Format string + Mask Input + Quality int + Rects []Rect + type Error struct + Code string + Header http.Header + Message string + RetryAfter time.Duration + Status int + func (e *Error) Error() string + func (e *Error) Is(target error) bool + type Event struct + Job *Job + Raw json.RawMessage + Type string + func VerifyWebhook(body []byte, header, secret string, tolerance time.Duration) (*Event, error) + func VerifyWebhookAt(body []byte, header, secret string, tolerance time.Duration, now time.Time) (*Event, error) + type ExpandOptions struct + Aspect string + Bottom int + Fill string + Format string + Left int + Quality int + Right int + Top int + type Face struct + Box FaceBox + Landmarks FaceLandmarks + Roll float64 + Score float64 + type FaceBox struct + Height float64 + Width float64 + X float64 + Y float64 + type FaceLandmarks struct + LeftEye Point + MouthLeft Point + MouthRight Point + Nose Point + RightEye Point + type FacesResult struct + Faces []Face + Height int + Raw json.RawMessage + Width int + func (r *FacesResult) UnmarshalJSON(data []byte) (err error) + type FindFacesOptions struct + MinScore float64 + type Finding struct + Code string + Detail string + Message string + Severity string + type FixResult struct + Findings []string + Passed bool + type FoundText struct + OnProduct *bool + Text string + type IDPhotoDocument struct + Alteration string + Background string + Checked string + EyesFromBottomMm []float64 + HeadMaxMm float64 + HeadMinMm float64 + HeightMm float64 + Name string + Notes []string + Raw json.RawMessage + Sources []string + Title string + WidthMm float64 + func (d *IDPhotoDocument) UnmarshalJSON(data []byte) (err error) + type IDPhotoOptions struct + Background string + DPI int + Document string + EyesMaxMm float64 + EyesMinMm float64 + Format string + HeadMaxMm float64 + HeadMinMm float64 + HeightMm float64 + Quality int + WidthMm float64 + type IDPhotoResult struct + Findings []string + HeadMm float64 + Passed bool + type IdentifyLabel struct + ABVs []float64 + Ages []int + Counts []int + Packs []int + Quantities []Measure + SPFs []int + Sizes []float64 + Specs []Measure + Strengths []Measure + WeakAges []int + Years []int + type IdentifyOptions struct + Catalogue string + Top int + type IdentifyResult struct + Barcodes []string + Candidates []Candidate + Catalogue string + Label IdentifyLabel + Ms map[string]int64 + Raw json.RawMessage + Text string + func (r *IdentifyResult) UnmarshalJSON(data []byte) (err error) + type Image struct + Bytes []byte + ContentType string + Header http.Header + Height int + Quality int + ServerTiming string + SubjectFound *bool + Width int + func (img *Image) Extension() string + func (img *Image) Save(path string) error + type Input struct + func Bytes(name string, b []byte) Input + func File(path string) Input + func Reader(name string, r io.Reader) Input + func (in Input) IsZero() bool + type ItemError struct + Code string + Message string + func (e *ItemError) Error() string + func (e *ItemError) UnmarshalJSON(data []byte) error + type Job struct + Counts JobCounts + CreatedAt int64 + FinishedAt int64 + ID string + Items []JobItem + Operation string + Params string + Raw json.RawMessage + Status string + Webhook *JobWebhook + func (j *Job) Completed() bool + func (j *Job) UnmarshalJSON(data []byte) (err error) + type JobCounts struct + Done int + Failed int + Pending int + Total int + type JobItem struct + Bytes int64 + ContentType string + Error *ItemError + Headers map[string]string + Input string + Result string + Status string + URL string + type JobItemResult struct + Body []byte + ContentType string + Header http.Header + func (r *JobItemResult) BlurFaces() (*BlurFacesResult, error) + func (r *JobItemResult) Crop() (*Image, error) + func (r *JobItemResult) Fix() (*FixResult, error) + func (r *JobItemResult) IDPhoto() (*IDPhotoResult, error) + func (r *JobItemResult) Image() *Image + func (r *JobItemResult) IsImage() bool + func (r *JobItemResult) IsJSON() bool + func (r *JobItemResult) JSON(v any) error + func (r *JobItemResult) RemoveBackground() (*Image, error) + func (r *JobItemResult) RemoveText() (*RemoveTextResult, error) + func (r *JobItemResult) RestoreFaces() (*RestoreFacesResult, error) + func (r *JobItemResult) Select() (*SelectResult, error) + func (r *JobItemResult) Vectorize() (*VectorizeResult, error) + type JobRequest struct + Images []Input + Operation string + Params map[string]any + Recipe string + URLs []string + WebhookURL string + type JobSummary struct + Counts JobCounts + CreatedAt int64 + FinishedAt int64 + ID string + Operation string + Status string + type JobWebhook struct + Attempts int + Delivered bool + LastError string + URL string + type JobsService struct + func (s *JobsService) Create(ctx context.Context, req *JobRequest) (*Job, error) + func (s *JobsService) Delete(ctx context.Context, id string) error + func (s *JobsService) Get(ctx context.Context, id string) (*Job, error) + func (s *JobsService) Item(ctx context.Context, id string, n int) (*JobItemResult, error) + func (s *JobsService) List(ctx context.Context) ([]JobSummary, error) + func (s *JobsService) Wait(ctx context.Context, id string, opts *WaitOptions) (*Job, error) + type LabelAlcohol struct + ABV float64 + Text string + type LabelDate struct + Date string + Kind string + Text string + type LabelDetails struct + AgeYears *int + Alcohol *LabelAlcohol + Allergens []string + Bottled *int + Claims []string + Dates []LabelDate + Electrical *LabelElectric + GS1 *LabelGS1 + GTIN string + Headline []string + Ingredients string + Lot string + Materials []LabelMaterial + MayContain []string + Model string + NetQuantity *LabelQuantity + Nutrition *LabelNutrition + Origin string + Serial string + Vintage *int + type LabelElectric struct + BatteryMAh *float64 + Frequency string + PowerW *float64 + Voltage string + type LabelGS1 struct + Batch string + BestBefore string + Count *int + Expiry string + GTIN string + NetWeightKg *float64 + Packed string + Production string + Serial string + type LabelMaterial struct + Name string + Percent *float64 + type LabelNutrition struct + Carbohydrate *float64 + EnergyKJ *float64 + EnergyKcal *float64 + Fat *float64 + Fibre *float64 + Per string + Protein *float64 + Salt *float64 + Saturates *float64 + Sugars *float64 + type LabelQuantity struct + Count *int + Grams *float64 + Ml *float64 + Text string + Unit string + Value float64 + type LabelResult struct + Barcodes []map[string]any + Label LabelDetails + Ms map[string]int64 + Raw json.RawMessage + Text []string + func (r *LabelResult) UnmarshalJSON(data []byte) (err error) + type Marketplace struct + Checked string + Fix map[string]any + Name string + Notes []string + Raw json.RawMessage + Rules []map[string]any + Sources []string + Title string + func (m *Marketplace) UnmarshalJSON(data []byte) (err error) + type Measure struct + Unit string + Value float64 + type Metrics struct + Border Border + Brightest float64 + Brightness float64 + Height int + HighlightsClipped float64 + Noise *float64 + ShadowsClipped float64 + Sharpness float64 + Subject *Subject + Width int + type Option func(*Client) error + func WithBaseURL(baseURL string) Option + func WithHTTPClient(hc *http.Client) Option + func WithRetries(n int) Option + func WithTimeout(d time.Duration) Option + func WithUserAgent(userAgent string) Option + type PaletteColor struct + Hex string + RGB []int + Share float64 + type PaletteOptions struct + Colors int + type PaletteResult struct + Colors []PaletteColor + Height int + Raw json.RawMessage + Width int + func (r *PaletteResult) UnmarshalJSON(data []byte) (err error) + type Point struct + X float64 + Y float64 + func (p *Point) UnmarshalJSON(data []byte) error + func (p Point) MarshalJSON() ([]byte, error) + type Preset struct + Description string + Name string + type ReadBarcodesOptions struct + AllFormats bool + Engine string + type Rect struct + Height int + Width int + X int + Y int + type RemoveBackgroundOptions struct + Align string + Background string + BackgroundImage Input + Blur float64 + Crop bool + Fill float64 + Format string + Height int + Mask bool + Padding int + Quality int + Reflection bool + Shadow string + Width int + type RemoveTextOptions struct + Format string + Matching string + Quality int + Region string + type RemoveTextResult struct + Kept int + Removed int + type ResizeOptions struct + Background string + DPI int + Enlarge bool + Fit string + Format string + Height int + MaxBytes int + Quality int + Trim bool + TrimTolerance *int + Width int + type RestoreFacesOptions struct + Format string + MinScore float64 + Quality int + Strength float64 + type RestoreFacesResult struct + Faces int + FacesSkipped int + type RunOptions struct + Preset string + Recipe string + type SelectOptions struct + Background string + Box Rect + Crop bool + Exclude []Point + Format string + Mask bool + Padding int + Pick string + Points []Point + Quality int + type SelectResult struct + Score float64 + type Subject struct + Area float64 + BackgroundWhite float64 + Fill float64 + Height int + Touches []string + Width int + X int + Y int + type TextLine struct + Box [][]float64 + Score float64 + Text string + type TextResult struct + Lines []TextLine + Ms map[string]int64 + Raw json.RawMessage + func (r *TextResult) UnmarshalJSON(data []byte) (err error) + type UpscaleOptions struct + Format string + Quality int + Scale float64 + type VectorizeOptions struct + Curves string + Detail int + Mode string + Speckle *int + type VectorizeResult struct + Paths int + type Verdict struct + Checked string + Findings []Finding + Marketplace string + NotChecked []string + Notes []string + Passed bool + Sources []string + Title string + type WaitOptions struct + Interval time.Duration + Timeout time.Duration + type WatermarkOptions struct + Color string + Format string + Margin *float64 + Opacity float64 + Position string + Quality int + Scale float64 + Text string + Tile bool + Watermark Input + type WebhookError struct + Reason string + func (e *WebhookError) Error() string + type WebhookSecret struct + Header string + Scheme string + Secret string