Jiehfeng
Jiehfeng

Reputation: 1027

How are images scaled without aliasing in Flutter?

I have tried both high quality png files and SVG files through the svg package, but no matter what when I scale the image smaller, heavy aliasing appears on the image.

How do professional apps keep their images high quality and vector like when scaled down?

Upvotes: 0

Views: 1589

Answers (2)

Imran alhallaq
Imran alhallaq

Reputation: 25

User filter quality

Image(
                  width: 400,
                  height: 200,
                  filterQuality: FilterQuality.high,
                  image: AssetImage(
                    'assets/images/logo.png',
                  ),
                ),

Upvotes: 0

Iqbal Rahat
Iqbal Rahat

Reputation: 85

Now Flutter doesn't clip by deafult. There are a few exceptions tho, like ClipRect. You need to explicitly set clipBehavior in widgets constructions. This change has appeared due to performance issues.

Add clipBehavior: Clip.antiAlias if you need anti-aliased clipping.

Add clip.antiAliasWithSaveLayer if you want to get the result before these changes were made. Please note that it's costly in performance.

Upvotes: 1

Related Questions