FilterQuality enum Null safety

Quality levels for image sampling in ImageFilter and Shader objects that sample images and for Canvas operations that render images.

When scaling up typically the quality is lowest at none, higher at low and medium, and for very large scale factors (over 10x) the highest at high.

When scaling down, medium provides the best quality especially when scaling an image to less than half its size or for animating the scale factor between such reductions. Otherwise, low and high provide similar effects for reductions of between 50% and 100% but the image may lose detail and have dropouts below 50%.

To get high quality when scaling images up and down, or when the scale is unknown, medium is typically a good balanced choice.

When building for the web using the --web-renderer=html option, filter quality has no effect. All images are rendered using the respective browser's default setting.

See also:

Inheritance

Constructors

FilterQuality()
const

Values

none → const FilterQuality

The fastest filtering method, albeit also the lowest quality.

This value results in a "Nearest Neighbor" algorithm which just repeats or eliminates pixels as an image is scaled up or down.

FilterQuality()
low → const FilterQuality

Better quality than none, faster than medium.

This value results in a "Bilinear" algorithm which smoothly interpolates between pixels in an image.

FilterQuality()
medium → const FilterQuality

The best all around filtering method that is only worse than high at extremely large scale factors.

This value improves upon the "Bilinear" algorithm specified by low by utilizing a Mipmap that pre-computes high quality lower resolutions of the image at half (and quarter and eighth, etc.) sizes and then blends between those to prevent loss of detail at small scale sizes.

See also:

  • FilterQuality class-level documentation that goes into detail about relative qualities of the constant values.
FilterQuality()
high → const FilterQuality

Best possible quality when scaling up images by scale factors larger than 5-10x.

When images are scaled down, this can be worse than medium for scales smaller than 0.5x, or when animating the scale factor.

This option is also the slowest.

This value results in a standard "Bicubic" algorithm which uses a 3rd order equation to smooth the abrupt transitions between pixels while preserving some of the sense of an edge and avoiding sharp peaks in the result.

See also:

  • FilterQuality class-level documentation that goes into detail about relative qualities of the constant values.
FilterQuality()

Properties

hashCode int
The hash code for this object.
read-onlyinherited
index int
A numeric identifier for the enumerated value.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<FilterQuality>
A constant List of the values in this enum, in order of their declaration.
[none, low, medium, high]