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

Method reloadImageForProcessing

processing/processing.go:166–181  ·  view source on GitHub ↗

reloadImageForProcessing reloads the image for processing. For animated images, it loads all frames up to MaxAnimationFrames.

(
	img *vips.Image,
	imgdata imagedata.ImageData,
	po ProcessingOptions,
	asAnimated bool,
)

Source from the content-addressed store, hash-verified

164// reloadImageForProcessing reloads the image for processing.
165// For animated images, it loads all frames up to MaxAnimationFrames.
166func (p *Processor) reloadImageForProcessing(
167 img *vips.Image,
168 imgdata imagedata.ImageData,
169 po ProcessingOptions,
170 asAnimated bool,
171) error {
172 // If we are going to process the image as animated, we need to load all frames
173 // up to MaxAnimationFrames
174 if asAnimated {
175 frames := min(img.Pages(), po.MaxAnimationFrames())
176 return img.Load(imgdata, 1.0, 0, frames)
177 }
178
179 // Otherwise, we just need to remove any animation-related data
180 return img.RemoveAnimation()
181}
182
183// checkImageSize checks the image dimensions and number of frames against security options.
184// It returns the image width, height and a security check error, if any.

Callers 1

ProcessImageMethod · 0.95

Calls 4

PagesMethod · 0.80
LoadMethod · 0.80
RemoveAnimationMethod · 0.80
MaxAnimationFramesMethod · 0.45

Tested by

no test coverage detected