PeachImage

PeachImage.DecoderOptions

DecoderOptions.AllowedFormats Property

The names of the formats Load(Stream, DecoderOptions) and Identify(Stream, DecoderOptions) may accept ("jpeg", "png", "gif", "webp", ...: the FormatName values of SupportedFormats, compared ignoring case). When null (the default) every format is allowed.

public System.Collections.Generic.IReadOnlySet<string>? AllowedFormats { get; init; }

Property Value

System.Collections.Generic.IReadOnlySet<System.String>

Remarks

The check happens right after the format is recognised from the stream’s signature, so an image in a format outside the set throws UnsupportedFormatException before any decoder for that format runs; data that matches no format at all still throws UnknownImageFormatException. An empty set allows nothing. A codec chosen explicitly by a format-selecting options type (raw CCITT, embedded JBIG2) is checked the same way.