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

Function fixIcoSize

processing/fix_size.go:84–102  ·  view source on GitHub ↗
(img *vips.Image)

Source from the content-addressed store, hash-verified

82}
83
84func fixIcoSize(img *vips.Image) error {
85 icoLimitShrink := float64(max(img.Width(), img.Height())) / icoMaxDimension
86
87 if icoLimitShrink <= 1.0 {
88 return nil
89 }
90
91 scale := 1.0 / icoLimitShrink
92 if err := img.Resize(scale, scale); err != nil {
93 return err
94 }
95
96 slog.Warn(fmt.Sprintf(
97 "ICO dimension size is limited to %d. The image is rescaled to %dx%d",
98 int(icoMaxDimension), img.Width(), img.Height(),
99 ))
100
101 return nil
102}
103
104func (p *Processor) fixSize(c *Context) error {
105 switch c.PO.Format() {

Callers 1

fixSizeMethod · 0.85

Calls 4

ResizeMethod · 0.80
WarnMethod · 0.80
WidthMethod · 0.45
HeightMethod · 0.45

Tested by

no test coverage detected