unjs / ipx

🖼️ High performance, secure and easy-to-use image optimizer.
MIT License
1.54k stars 61 forks source link

[v2] apply quality without resizing #26

Closed tanc closed 3 years ago

tanc commented 3 years ago

The nuxt image module uses ipx to provide the image processing endpoint and it passes through a quality option like q=65 in the url. From what I can tell this is ignored at the ipx end. Is it possible to use this to tell sharp to resize/process at a specific quality level?

tanc commented 3 years ago

Looking through the code there does seem to be a q option but in my tests it didn't change the file size at all: https://github.com/nuxt/image/issues/184

pi0 commented 3 years ago

Hi dear @tanc. Actually there is quality support but you need to provide dimensions (width and/or height) in order to make it applied. BTW both ipx and image module are WIP so this is expected.

tanc commented 3 years ago

@pi0 thanks for responding! No problem, I understand its in beta, I just wanted to report findings so that things can be worked out and improved!

tanc commented 3 years ago

Just to be sure, is it supposed to work (resizing) in develop mode? I'm trying width and height with quality like this:

http://localhost:3000/_ipx/images/rich.jpg?f=jpeg&q=95&w=1000&h=1000

The results are always the same file size when I vary the value of q.

pi0 commented 3 years ago

Hi @tanc. Quality handling fixed in ipx 0.6.0 / image 0.4.0.

tanc commented 3 years ago

Thank you!