Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage: Image quality transformation is respected for createSignedUrl() but not for download() #834

Open
pdurasie opened this issue Feb 10, 2024 · 0 comments
Labels
bug Something isn't working storage This issue or pull request is related to storage

Comments

@pdurasie
Copy link

Describe the bug
For supabase storage, when you use transform params together with quality parameter in the download method, the returned image will respect the height and width params but ignore the quality. In other words, no matter whether you pass in quality: 20 or quality: 100, the returned image will be the same.

Additionally, the image will be returned in PNG even though WebP would be expected, as I'm working with Flutter Web (Chrome), but this might be a separate issue with Automatic image optimization.

To Reproduce
Steps to reproduce the behavior:

  1. Upload a PNG image to a bucket
  2. Run this in Flutter Web (Chrome) and check the file size, dimensions and image quality in Chrome DevTools
await supabase.storage.from('my-bucket').download(
          'my_img.png',
          transform: const TransformOptions(
            height: 840,
            width: 480,
            quality: 100,
          ),
        );
  1. Clear cache and run this in Flutter Web (Chrome) and check the file size, dimensions and image quality in Chrome DevTools
await supabase.storage.from('my-bucket').download(
          'my_img.png',
          transform: const TransformOptions(
            height: 840,
            width: 480,
            quality: 20,
          ),
        );

You will see that the downloaded images in 2. and 3. will be PNG, identical file size, of dimensions 480x840 and 100% quality.

Expected behavior
The downloaded images should differ in file size and quality (and be WebP).

Version (please complete the following information):
├── supabase_flutter 2.3.2
│ ├── supabase 2.0.7
│ │ ├── functions_client 2.0.0
│ │ ├── gotrue 2.5.0
│ │ ├── postgrest 2.1.0
│ │ ├── realtime_client 2.0.0
│ │ ├── storage_client 2.0.1

Additional context
Using the same parameters to createSignedUrl and then pasting that URL into Chrome does affect the returned image as expected (different quality and WebP).

I have not tested mobile.

I have not tested other image formats but PNG.

@pdurasie pdurasie added the bug Something isn't working label Feb 10, 2024
@dshukertjr dshukertjr added the storage This issue or pull request is related to storage label Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working storage This issue or pull request is related to storage
Projects
None yet
Development

No branches or pull requests

2 participants