Options

Structin imageoptocompute-sdk-go v1.11.0View source
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
type Options struct {
BgColor *HexColor
Blur BlurMode
Brightness int
Bw BWMode
Contrast int
Dpr float32
Enable EnableOpt
Frame uint32
Optimize OptimizeLevel
Orient Orientation
Pad *Sides
Precrop *Crop
Quality uint32
ResizeFilter ResizeAlgorithm
Saturation int
Trim *Sides
PreserveQueryStringOnOriginRequest bool
}

Options contains options that correspond to the public ImageOptimzation API.

For more details, see https://www.fastly.com/documentation/reference/io/

Fields

Region

Region

Region indicates where image transformations will occur. Must be set.

The chosen region should be close to your origin.

Auto

Auto

Auto requests an output format based on the Accept header.

BgColor

*HexColor

BgColor Sets a background color when replacing transparent pixels or with pad or canvas.

Blur blurs the image.

Brightness

int

Brightness adjusts image brightness.

Bw converts image to black and white duotone.

Canvas

*Canvas

Canvas adds a canvas surrounding the image.

Contrast

int

Contrast adjusts image contrast.

Crop

*Crop

/ Crop crops the image.

Dpr

float32

Dps is the ratio between physical and logical pixels, a float between 0-10.

Adjusts any resize requests according to this ratio.

Enable

EnableOpt

Enable Allows for various image transformations to occur, particularly upscaling images.

Fit

Fit

Fit describes how the image should fit within the requested dimensions.

Format

Format

Format re-encodes the image to a given output format.

Frame

uint32

Frame requests a single frame for an animated image.

Currently only supported for animated GIFs.

Height adjusts image height.

Level

Level

Level configures GIF to MP4 conversions.

See https://www.fastly.com/documentation/reference/io/level/ for detailed information.

Metadata

Metadata

Metadata preserves metadata on the input image.

Optimize attempts to select an output quality to optimize the image.

Orient controls how the image will be oriented.

Pad

*Sides

Pad adds pixels surrounding the image.

Precrop

*Crop

Precrop applies the crop instruction before all other parameters.

Profile

Profile

Profile is For use with GIF to MP4 conversions.

See https://www.fastly.com/documentation/reference/io/level/ for detailed information.

Quality

uint32

Quality requests an output quality.

ResizeFilter

ResizeAlgorithm

Saturation

int

Saturation adjusts image saturation.

Sharpen

*Sharpen

Sharpen applies an unsharp mask to the image.

Trim

*Sides

Trim removes pixels from the image on all sides.

TrimColor

*TrimColor

TrimColor trims the image on all sides based on a given color.

Width adjusts image width.

PreserveQueryStringOnOriginRequest

bool

/ If true, preserves query parameters not belonging to the / Image Optimizer API when requesting the origin image.

Methods

QueryString

View source
func (o *Options) QueryString() (string, error)

Returns

(string, error)