Skip to content

[iOS] Rendering images with borders causes jagged/aliased edges #170056

Closed

Description

@yaminet1024

Steps to reproduce

1.Use an image example.png or url https://i.ibb.co/KxGsDbcQ/3.png
2.Render it in Flutter using Image
3. Observe the edges on iOS physical devices

Expected results

The png image borders should render smoothly with proper anti-aliasing

Image

Image

skia on flutter 3.22:

Image

Actual results

impeller on flutter stable:

Image

Image

Image

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // TRY THIS: Try running your application with "flutter run". You'll see
        // the application has a purple toolbar. Then, without quitting the app,
        // try changing the seedColor in the colorScheme below to Colors.green
        // and then invoke "hot reload" (save your changes or press the "hot
        // reload" button in a Flutter-supported IDE, or press "r" if you used
        // the command line to start the app).
        //
        // Notice that the counter didn't reset back to zero; the application
        // state is not lost during the reload. To reset the state, use hot
        // restart instead.
        //
        // This works for code too, not just values: Most code changes can be
        // tested with just a hot reload.
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        // TRY THIS: Try changing the color here to a specific color (to
        // Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
        // change color while the other colors stay the same.
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: Column(
          // Column is also a layout widget. It takes a list of children and
          // arranges them vertically. By default, it sizes itself to fit its
          // children horizontally, and tries to be as tall as its parent.
          //
          // Column has various properties to control how it sizes itself and
          // how it positions its children. Here we use mainAxisAlignment to
          // center the children vertically; the main axis here is the vertical
          // axis because Columns are vertical (the cross axis would be
          // horizontal).
          //
          // TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
          // action in the IDE, or press "p" in the console), to see the
          // wireframe for each widget.
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text('You have pushed the button this many times:'),
            Image.network("https://i.ibb.co/KxGsDbcQ/3.png",height: 500,fit: BoxFit.cover,isAntiAlias: true),
            //or Image.asset("assets/images/example.png",isAntiAlias: true,filterQuality: FilterQuality.high),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Image

Screenshots or Video

Logs

No response

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.32.2, on macOS 15.3.2 24D81 darwin-arm64, locale
    zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
    ✗ cmdline-tools component is missing.
      Try installing or updating Android Studio.
      Alternatively, download the tools from
      https://developer.android.com/studio#command-line-tools-only and make sure
      to set the ANDROID_HOME environment variable.
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/to/macos-android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] VS Code (version 1.100.3)
[✓] Connected device (4 available)
[✓] Network resources

Activity

  1. changed the title [-]Rendering images with semi-transparent borders causes jagged/aliased edges on iOS physical devices[/-] [+]Rendering images with semi-transparent borders causes jagged/aliased edges on iOS physical devices impeller[/+] on Jun 5, 2025
  2. changed the title [-]Rendering images with semi-transparent borders causes jagged/aliased edges on iOS physical devices impeller[/-] [+]Rendering images with borders causes jagged/aliased edges on iOS physical devices impeller[/+] on Jun 6, 2025
  3. changed the title [-]Rendering images with borders causes jagged/aliased edges on iOS physical devices impeller[/-] [+][iOS] Rendering images with borders causes jagged/aliased edges[/+] on Jun 6, 2025
  4. danagbemava-nc commented on Jun 6, 2025

    @danagbemava-nc
    Member

    Reproduces on my iPhone 16 Pro Max but not my iPhone XS.

    Seems like this is a duplicate of #170089

    iPhone XS iPhone 16 Pro Max

    Labeling for further insight

    flutter doctor -v
    [✓] Flutter (Channel stable, 3.32.2, on macOS 15.5 24F74 darwin-arm64, locale en-US) [973ms]
        • Flutter version 3.32.2 on channel stable at /Users/deanli/dev/stable
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 8defaa71a7 (2 days ago), 2025-06-04 11:02:51 -0700
        • Engine revision 1091508939
        • Dart version 3.8.1
        • DevTools version 2.45.1
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [2.0s]
        • Android SDK at /Users/deanli/Library/Android/sdk
        • Platform android-36, build-tools 36.0.0
        • Java binary at: /Users/deanli/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
          This is the JDK bundled with the latest Android Studio installation on this machine.
          To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 16.4) [1,632ms]
        • Xcode at /Applications/Xcode-16.4.0-Beta.app/Contents/Developer
        • Build 16F1t
        • CocoaPods version 1.16.2
    
    [✓] Chrome - develop for the web [9ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2025.1) [8ms]
        • Android Studio at /Users/deanli/Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)
    
    [✓] VS Code (version 1.100.0) [7ms]
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.110.0
    
    [✓] Connected device (6 available) [8.0s]
        • Dean’s iPad (wireless) (mobile)       • 00008103-000825C811E3401E            • ios            • iOS 18.5 22F76
        • iPhone 16 Pro Max (wireless) (mobile) • 00008140-00194CC23A68801C            • ios            • iOS 18.5 22F76
        • Nexus (wireless) (mobile)             • 00008020-001875E83A38002E            • ios            • iOS 18.5 22F76
        • iPhone 16 Pro (mobile)                • 63C28242-27C4-477D-A63A-BC88BADB1BCA • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-5 (simulator)
        • macOS (desktop)                       • macos                                • darwin-arm64   • macOS 15.5 24F74 darwin-arm64
        • Chrome (web)                          • chrome                               • web-javascript • Google Chrome 137.0.7151.69
        ! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
          The device must be opted into Developer Mode to connect wirelessly. (code -27)
    
    [✓] Network resources [1,418ms]
        • All expected network resources are available.
    
    • No issues found!
    
    [!] Flutter (Channel master, 3.33.0-1.0.pre.398, on macOS 15.5 24F74 darwin-arm64, locale en-US) [4.7s]
        • Flutter version 3.33.0-1.0.pre.398 on channel master at /Users/deanli/dev/master
        ! Warning: `flutter` on your path resolves to /Users/deanli/dev/stable/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/deanli/dev/master. Consider adding /Users/deanli/dev/master/bin to the front of your path.
        ! Warning: `dart` on your path resolves to /Users/deanli/dev/stable/bin/dart, which is not inside your current Flutter SDK checkout at /Users/deanli/dev/master. Consider adding /Users/deanli/dev/master/bin to the front of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 09405e87d8 (9 hours ago), 2025-06-05 23:40:26 +0000
        • Engine revision 09405e87d8
        • Dart version 3.9.0 (build 3.9.0-196.0.dev)
        • DevTools version 2.47.0
        • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [1,677ms]
        • Android SDK at /Users/deanli/Library/Android/sdk
        • Emulator version 35.6.9.0 (build_id 13473012) (CL:N/A)
        • Platform android-36, build-tools 36.0.0
        • Java binary at: /Users/deanli/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
          This is the JDK bundled with the latest Android Studio installation on this machine.
          To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 16.4) [1,214ms]
        • Xcode at /Applications/Xcode-16.4.0-Beta.app/Contents/Developer
        • Build 16F1t
        • CocoaPods version 1.16.2
    
    [✓] Chrome - develop for the web [11ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2025.1) [10ms]
        • Android Studio at /Users/deanli/Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)
    
    [✓] VS Code (version 1.100.0) [9ms]
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.110.0
    
    [✓] Connected device (6 available) [6.9s]
        • Dean’s iPad (wireless) (mobile)       • 00008103-000825C811E3401E            • ios            • iOS 18.5 22F76
        • iPhone 16 Pro Max (wireless) (mobile) • 00008140-00194CC23A68801C            • ios            • iOS 18.5 22F76
        • Nexus (wireless) (mobile)             • 00008020-001875E83A38002E            • ios            • iOS 18.5 22F76
        • iPhone 16 Pro (mobile)                • 63C28242-27C4-477D-A63A-BC88BADB1BCA • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-5 (simulator)
        • macOS (desktop)                       • macos                                • darwin-arm64   • macOS 15.5 24F74 darwin-arm64
        • Chrome (web)                          • chrome                               • web-javascript • Google Chrome 137.0.7151.69
        ! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
          The device must be opted into Developer Mode to connect wirelessly. (code -27)
    
    [✓] Network resources [667ms]
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
    
  5. added
    platform-iosiOS applications specifically
    engineflutter/engine related. See also e: labels.
    a: imagesLoading, displaying, rendering images
    c: renderingUI glitches reported at the engine/skia or impeller rendering level
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    fyi-iosFor the attention of iOS platform team
    and removed
    in triagePresently being triaged by the triage team
    on Jun 6, 2025
  6. added
    P2Important issues not at the top of the work list
    on Jun 9, 2025
  7. jonahwilliams commented on Jun 9, 2025

    @jonahwilliams
    Contributor

    Potential ideas:

    • Texture compression
    • Wide gamut related
    • rounding problem that is more apparent on higher res screen?
    • misue of MPS for image resize.
  8. github-actions commented on Jun 30, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  9. locked as resolved and limited conversation to collaborators on Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: imagesLoading, displaying, rendering imagesc: renderingUI glitches reported at the engine/skia or impeller rendering levelengineflutter/engine related. See also e: labels.found in release: 3.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions