FilterQuality
Inherits: Enum
Properties
-
HIGH–Best possible quality when scaling up images by scale factors larger than 5-10x.
-
LOW–Better quality than none, faster than medium.
-
MEDIUM–The best all around filtering method that is only worse than high at extremely large scale factors.
-
NONE–The fastest filtering method, albeit also the lowest quality.
Examples#
Showcase#
import flet as ft
IMAGE_URL = "https://picsum.photos/id/1025/64/64"
def showcase_card(quality: ft.FilterQuality) -> ft.Container:
return ft.Container(
width=300,
padding=12,
border=ft.Border.all(1, ft.Colors.RED),
border_radius=10,
bgcolor=ft.Colors.SURFACE_CONTAINER_LOW,
content=ft.Column(
spacing=8,
controls=[
ft.Text(quality.name, weight=ft.FontWeight.BOLD),
ft.Container(
width=240,
height=120,
border=ft.Border.all(1, ft.Colors.OUTLINE),
border_radius=8,
clip_behavior=ft.ClipBehavior.HARD_EDGE,
bgcolor=ft.Colors.SURFACE,
content=ft.Image(
src=IMAGE_URL,
width=240,
height=120,
fit=ft.BoxFit.FILL,
filter_quality=quality,
),
),
],
),
)
def main(page: ft.Page):
page.theme_mode = ft.ThemeMode.DARK
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
page.appbar = ft.AppBar(title="FilterQuality Showcase")
page.add(
ft.Text("Compare image sampling quality while scaling the same source image."),
ft.Row(
wrap=True,
spacing=12,
expand=True,
scroll=ft.ScrollMode.AUTO,
alignment=ft.MainAxisAlignment.CENTER,
controls=[showcase_card(quality) for quality in ft.FilterQuality],
),
)
ft.run(main)
Properties#
HIGH = 'high'
class-attribute
instance-attribute
#
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.
LOW = 'low'
class-attribute
instance-attribute
#
Better quality than none, faster than medium.
MEDIUM = 'medium'
class-attribute
instance-attribute
#
The best all around filtering method that is only worse than high at extremely large scale factors.
NONE = 'none'
class-attribute
instance-attribute
#
The fastest filtering method, albeit also the lowest quality.