Skip to content

Resizing parameters are not supported for multi-frame images in the engine. #137668

Closed

Description

@LimeVista

instantiateImageCodecFromBuffer not supported resize webp animation.

  • instantiateImageCodecFromBuffer need to support resizing of image animation (Flutter engine not supported);
  • ImmutableBuffer allows constructing from native ptr, This can improve performance;

Activity

  1. darshankawar commented on Nov 1, 2023

    @darshankawar
    Member

    @LimeVista
    Can you elaborate by providing an example that shows what is not supported and what exactly is your use case and proposal ?

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 1, 2023
  3. LimeVista commented on Nov 2, 2023

    @LimeVista
    Author

    Reference code image_descriptor.cc L119.
    This feature is not implemented.

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 2, 2023
  5. darshankawar commented on Nov 2, 2023

    @darshankawar
    Member

    @LimeVista
    https://api.flutter.dev/flutter/painting/PaintingBinding/instantiateImageCodecFromBuffer.html shows that the method is deprecated and instead instantiateImageCodecWithSize should be used. Does that help in your use case ?

  6. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 2, 2023
  7. LimeVista commented on Nov 2, 2023

    @LimeVista
    Author

    @darshankawar
    Not worked as expected. Because both are implemented using ImageDescriptor.instantiateCodec.

    Test Code:

    import 'dart:ui';
    
    import 'package:flutter/material.dart';
    
    void main() {
      runApp(const DemoApp());
    }
    
    class DemoApp extends StatelessWidget {
      const DemoApp({super.key});
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData(
            colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepOrange),
            useMaterial3: true,
          ),
          home: const HomePage(),
        );
      }
    }
    
    class HomePage extends StatefulWidget {
      const HomePage({super.key});
    
      @override
      State<HomePage> createState() => _HomePageState();
    }
    
    class _HomePageState extends State<HomePage> {
      _HomePageState();
    
      /// webp animation url, image size: 400 x 400
      final imageUrl = 'https://mathiasbynens.be/demo/animated-webp-supported.webp';
    
      /// same [imageUrl] webp animation
      final assetPath = 'assets/images/animated-webp-supported.webp';
    
      @override
      void initState() {
        super.initState();
        decode();
      }
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          body: Center(
            child: SizedBox(
              width: 200,
              height: 200,
              // if webp animation, cacheWidth not work, output image width is 400.
              child: Image.network(imageUrl, cacheWidth: 128),
            ),
          ),
        );
      }
    
      /// decode webp animation
      void decode() async {
        const targetWidth = 50, targetHeight = 50;
        final buffer = await ImmutableBuffer.fromAsset(assetPath);
        final codec = await instantiateImageCodecWithSize(
          buffer,
          getTargetSize: (int intrinsicWidth, int intrinsicHeight) {
            // intrinsicWidth is 400, intrinsicHeight is 400
            return const TargetImageSize(width: targetWidth, height: targetHeight);
          },
        );
    
        final imageInfo = await codec.getNextFrame();
        
        // error, image size is 400 x 400
        assert(imageInfo.image.width == targetWidth &&
            imageInfo.image.height == targetHeight);
      }
    }
    
  8. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 2, 2023
  9. darshankawar commented on Nov 3, 2023

    @darshankawar
    Member

    Thanks for the update.

  10. added
    engineflutter/engine related. See also e: labels.
    a: imagesLoading, displaying, rendering images
    and removed
    in triagePresently being triaged by the triage team
    on Nov 3, 2023
  11. changed the title [-]`instantiateImageCodecFromBuffer` not supported resize webp animation.[/-] [+]Resizing parameters are not supported for multi-frame images in the engine.[/+] on Nov 6, 2023
  12. added
    P1High-priority issues at the top of the work list
    on Nov 6, 2023
  13. flutter-triage-bot commented on Mar 11, 2024

    @flutter-triage-bot

    This issue is marked P1 but has had no recent status updates.

    The P1 label indicates high-priority issues that are at the top of the work list. This is the highest priority level a bug can have if it isn't affecting a top-tier customer or breaking the build. Bugs marked P1 are generally actively being worked on unless the assignee is dealing with a P0 bug (or another P1 bug). Issues at this level should be resolved in a matter of months and should have monthly updates on GitHub.

    Please consider where this bug really falls in our current priorities, and label it or assign it accordingly. This allows people to have a clearer picture of what work is actually planned. Thanks!

  14. added
    P2Important issues not at the top of the work list
    and removed
    P1High-priority issues at the top of the work list
    on Mar 12, 2024
  15. github-actions commented on Nov 10, 2026

    @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.

  16. locked as resolved and limited conversation to collaborators on Nov 10, 2026
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 imagesengineflutter/engine related. See also e: labels.team-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