image_pixels icon indicating copy to clipboard operation
image_pixels copied to clipboard

imageProvider ignores dimensions of ResizeImage

Open IvanDeluxe opened this issue 3 years ago • 1 comments

Hi :)

First of all, thanks for the amazing package ❤

I cannot find information about this anywhere -- I'm getting unexpected results for the following code:

    final originalImage = AssetImage(silhouette['path']); // w100 h200
    final image = ResizeImage(
      originalImage,
      height: 100, // set the height to 100
    );
    
    return ImagePixels(
      imageProvider: image,
      builder: (context, img) {
        if (!img.hasImage) {
          return SizedBox();
        }
        
        print('${img.width}'); // 100
        print('${img.height}'); // 200

Is there a way to make ResizeImage work with ImagePixels?

IvanDeluxe avatar Apr 28 '22 19:04 IvanDeluxe

Hey Ivan. It's getting the size from the original image. I'd have to change it a lot to make it work with ResizeImage. I'll leave this issue open to work on this in the future, but it's not going to be soon. Meanwhile, since you know the image's height was changed to 100, you should do the calculations yourself, to find out the real width and height.

marcglasberg avatar May 02 '22 00:05 marcglasberg