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, )
| 164 | // reloadImageForProcessing reloads the image for processing. |
| 165 | // For animated images, it loads all frames up to MaxAnimationFrames. |
| 166 | func (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. |
no test coverage detected