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

Function fixHeifSize

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

Source from the content-addressed store, hash-verified

38}
39
40func fixHeifSize(img *vips.Image) error {
41 heifLimitShrink := float64(max(img.Width(), img.Height())) / heifMaxDimension
42
43 if heifLimitShrink <= 1.0 {
44 return nil
45 }
46
47 scale := 1.0 / heifLimitShrink
48 if err := img.Resize(scale, scale); err != nil {
49 return err
50 }
51
52 slog.Warn(fmt.Sprintf(
53 "AVIF/HEIC dimension size is limited to %d. The image is rescaled to %dx%d",
54 int(heifMaxDimension), img.Width(), img.Height(),
55 ))
56
57 return nil
58}
59
60func fixGifSize(img *vips.Image) error {
61 gifMaxResolution := float64(vips.GifResolutionLimit())

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