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

Method findPreferredFormat

processing/processing.go:352–360  ·  view source on GitHub ↗

findPreferredFormat finds a suitable preferred format based on image's properties.

(animated, expectTransparency bool)

Source from the content-addressed store, hash-verified

350
351// findPreferredFormat finds a suitable preferred format based on image's properties.
352func (p *Processor) findPreferredFormat(animated, expectTransparency bool) imagetype.Type {
353 for _, t := range p.config.PreferredFormats {
354 if p.isImageTypeCompatible(t, animated, expectTransparency) {
355 return t
356 }
357 }
358
359 return p.config.PreferredFormats[0]
360}
361
362func (p *Processor) transformImage(
363 ctx context.Context,

Callers 1

determineOutputFormatMethod · 0.95

Calls 1

isImageTypeCompatibleMethod · 0.95

Tested by

no test coverage detected