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

Method isImageTypeCompatible

processing/processing.go:336–349  ·  view source on GitHub ↗

isImageTypeCompatible checks if the given image type is compatible with the image properties.

(
	imgtype imagetype.Type,
	animated, expectTransparency bool,
)

Source from the content-addressed store, hash-verified

334
335// isImageTypeCompatible checks if the given image type is compatible with the image properties.
336func (p *Processor) isImageTypeCompatible(
337 imgtype imagetype.Type,
338 animated, expectTransparency bool,
339) bool {
340 if animated && !imgtype.SupportsAnimationSave() {
341 return false
342 }
343
344 if expectTransparency && !imgtype.SupportsAlpha() {
345 return false
346 }
347
348 return true
349}
350
351// findPreferredFormat finds a suitable preferred format based on image's properties.
352func (p *Processor) findPreferredFormat(animated, expectTransparency bool) imagetype.Type {

Callers 1

findPreferredFormatMethod · 0.95

Calls 2

SupportsAnimationSaveMethod · 0.80
SupportsAlphaMethod · 0.80

Tested by

no test coverage detected