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

WebP support #194

Closed
ishitatsuyuki opened this issue Sep 16, 2018 · 11 comments
Closed

WebP support #194

ishitatsuyuki opened this issue Sep 16, 2018 · 11 comments

Comments

@ishitatsuyuki
Copy link

While WebP is only supported by Chrome, its dominance of market means that about 70% of the users will able to load that format.

WebP is a good compromise between JPEG and PNG, in terms that it can perform lossy compression while not destroying alpha properties. It simply compresses better, too.

@piranha
Copy link

piranha commented Nov 20, 2018

Also any mobile app can implement WebP support, which makes it even more worthwhile.

@polarathene
Copy link

Firefox released version 65 early 2019, now providing WebP support too.

@teacoat
Copy link

teacoat commented Mar 8, 2019

Agreed, browser support is good enough and the benefits plenty, please support!

@lilith
Copy link
Member

lilith commented Jul 11, 2019

libwebp is 1.0 now, so we can support it.

@lilith lilith closed this as completed Jul 11, 2019
@lilith lilith reopened this Jul 11, 2019
@kepi
Copy link

kepi commented Mar 30, 2020

Are there any news about WebP support?

@lilith
Copy link
Member

lilith commented Apr 10, 2020

Not yet, although we had a big breakthrough today that should free up more dev effort towards webp and rewriting the webserver.

@kornelski
Copy link
Member

I'm maintaining bindings if you need them: https://lib.rs/crates/libwebp-sys

@lilith
Copy link
Member

lilith commented Apr 11, 2020

@kornelski Perfect! I'll use those. Do you have any suggestions for output tuning or presets? The array of options seems dizzying.

struct WebPConfig {
  int lossless;           // Lossless encoding (0=lossy(default), 1=lossless).
  float quality;          // between 0 and 100. For lossy, 0 gives the smallest
                          // size and 100 the largest. For lossless, this
                          // parameter is the amount of effort put into the
                          // compression: 0 is the fastest but gives larger
                          // files compared to the slowest, but best, 100.
  int method;             // quality/speed trade-off (0=fast, 6=slower-better)

  WebPImageHint image_hint;  // Hint for image type (lossless only for now).

  // Parameters related to lossy compression only:
  int target_size;        // if non-zero, set the desired target size in bytes.
                          // Takes precedence over the 'compression' parameter.
  float target_PSNR;      // if non-zero, specifies the minimal distortion to
                          // try to achieve. Takes precedence over target_size.
  int segments;           // maximum number of segments to use, in [1..4]
  int sns_strength;       // Spatial Noise Shaping. 0=off, 100=maximum.
  int filter_strength;    // range: [0 = off .. 100 = strongest]
  int filter_sharpness;   // range: [0 = off .. 7 = least sharp]
  int filter_type;        // filtering type: 0 = simple, 1 = strong (only used
                          // if filter_strength > 0 or autofilter > 0)
  int autofilter;         // Auto adjust filter's strength [0 = off, 1 = on]
  int alpha_compression;  // Algorithm for encoding the alpha plane (0 = none,
                          // 1 = compressed with WebP lossless). Default is 1.
  int alpha_filtering;    // Predictive filtering method for alpha plane.
                          //  0: none, 1: fast, 2: best. Default if 1.
  int alpha_quality;      // Between 0 (smallest size) and 100 (lossless).
                          // Default is 100.
  int pass;               // number of entropy-analysis passes (in [1..10]).

  int show_compressed;    // if true, export the compressed picture back.
                          // In-loop filtering is not applied.
  int preprocessing;      // preprocessing filter (0=none, 1=segment-smooth)
  int partitions;         // log2(number of token partitions) in [0..3]
                          // Default is set to 0 for easier progressive decoding.
  int partition_limit;    // quality degradation allowed to fit the 512k limit on
                          // prediction modes coding (0: no degradation,
                          // 100: maximum possible degradation).
  int use_sharp_yuv;      // if needed, use sharp (and slow) RGB->YUV conversion
};

@kornelski
Copy link
Member

I haven't looked into tuning these options yet.

@lilith
Copy link
Member

lilith commented Apr 11, 2020

Thanks! I've just used the simple encoder API for now.

WebP support can be activated using the webplossy {quality} and webplossless encoder presets or using &format=webp&webp.quality=x or &format=webp&webp.lossless=true respectively.

This is in master.

@lilith lilith closed this as completed Apr 11, 2020
@lilith
Copy link
Member

lilith commented Apr 13, 2020

Update: you now use &webp.lossless=true|false and &webp.quality=0..100 to adjust compression rather than reusing the jpeg quality command.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants