MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / trim

Method trim

processing/trim.go:3–30  ·  view source on GitHub ↗
(c *Context)

Source from the content-addressed store, hash-verified

1package processing
2
3func (p *Processor) trim(c *Context) error {
4 if !c.PO.TrimEnabled() {
5 return nil
6 }
7
8 // We need to import color profile before trim
9 if err := p.colorspaceToProcessing(c); err != nil {
10 return err
11 }
12
13 if err := c.Img.Trim(
14 c.PO.TrimThreshold(),
15 c.PO.TrimSmart(),
16 c.PO.TrimColor(),
17 c.PO.TrimEqualHor(),
18 c.PO.TrimEqualVer(),
19 ); err != nil {
20 return err
21 }
22 if err := c.Img.CopyMemory(); err != nil {
23 return err
24 }
25
26 c.ImgData = nil
27 c.CalcParams()
28
29 return nil
30}

Callers

nothing calls this directly

Calls 10

TrimEnabledMethod · 0.80
TrimMethod · 0.80
TrimThresholdMethod · 0.80
TrimSmartMethod · 0.80
TrimColorMethod · 0.80
TrimEqualHorMethod · 0.80
TrimEqualVerMethod · 0.80
CopyMemoryMethod · 0.80
CalcParamsMethod · 0.80

Tested by

no test coverage detected