initialLoadImage loads a single page/frame of the image. If the image format supports thumbnails and thumbnail loading is enforced, it tries to load the thumbnail first.
( img *vips.Image, imgdata imagedata.ImageData, enforceThumbnail bool, )
| 146 | // If the image format supports thumbnails and thumbnail loading is enforced, |
| 147 | // it tries to load the thumbnail first. |
| 148 | func (p *Processor) initialLoadImage( |
| 149 | img *vips.Image, |
| 150 | imgdata imagedata.ImageData, |
| 151 | enforceThumbnail bool, |
| 152 | ) (bool, error) { |
| 153 | if enforceThumbnail && imgdata.Format().SupportsThumbnail() { |
| 154 | if err := img.LoadThumbnail(imgdata); err == nil { |
| 155 | return true, nil |
| 156 | } else { |
| 157 | slog.Debug(fmt.Sprintf("Can't load thumbnail: %s", err)) |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | return false, img.Load(imgdata, 1.0, 0, 1) |
| 162 | } |
| 163 | |
| 164 | // reloadImageForProcessing reloads the image for processing. |
| 165 | // For animated images, it loads all frames up to MaxAnimationFrames. |
no test coverage detected