extensions icon indicating copy to clipboard operation
extensions copied to clipboard

storage-resize-images add compression option

Open huangjeff5 opened this issue 3 years ago • 1 comments

[READ] Step 1: Are you in the right place?

Issues filed here should be about a feature request for a specific extension in this repository. To file a feature request that affects multiple extensions or the Firebase Extensions platform, please reach out to Firebase support directly.

[REQUIRED] Step 2: Extension name

This feature request is for extension: _ (storage-resize-images)

What feature would you like to see?

Describe the feature you would like to add, or how you'd like to see the extension change.

Suggested by @apascal07, we should allow the user to specify that the file should be compressed / lower quality. (Sample docs of how to configure that in sharp here: https://stackoverflow.com/questions/51291678/compress-image-using-sharp-in-node-js)

How would you use it?

Tell us how you'd use this feature in your app.

huangjeff5 avatar Aug 16 '22 03:08 huangjeff5

HI @huangjeff5, I think this feature might be already existed by specifying the OUTPUT_OPTIONS param. For example: {"png":{"compressionLevel":9}} https://sharp.pixelplumbing.com/api-output#parameters-6 Can you please confirm if this serves your needs?

yamankatby avatar Aug 18 '22 12:08 yamankatby

@yamankatby You are referencing sharps documentation on this. Does this mean that sharps compression options params also apply to this extension?

I was only able to find this example in the extension page.

{"jpeg": { "quality": 5, "chromaSubsampling": "4:4:4" }, "png": { "pallete": true }}

Do you know where I can find the full api for this? This would be incredible if this extension supported lossly compression.

Jonathan002 avatar Jan 28 '23 23:01 Jonathan002

@Jonathan002 Reviewing the extension, we pass these options directly to sharp, so I think you can indeed pass on compression options within the OUTPUT_OPTIONS param, under the extension (e.g under the key png)

cabljac avatar Feb 03 '23 14:02 cabljac

I think the only action here would be to update documentation to reflect this

cabljac avatar May 25 '23 08:05 cabljac