swissspidy / media-experiments

WordPress media experiments
GNU General Public License v2.0
70 stars 1 forks source link

Add more options to preferences modal #256

Closed swissspidy closed 7 months ago

swissspidy commented 7 months ago

Maybe a dropdown per file type to have a mapping?

[x] Compress new images during upload?

Preferred image format (used for things like poster images etc.):

Choose preferred behavior:

.jpeg
  • Do nothing
  • Compress (browser)
  • Compress (wasm-vips, uses MozJPEG)
  • Convert to WebP (browser, if supported)
  • Convert to WebP (wasm-vips, uses libwebp)
  • Convert to AVIF (Wasm-vips, uses libavif)
.jpeg
  • Do nothing
  • Compress (browser)
  • Compress (wasm-vips, uses MozJPEG)
  • Convert to WebP (browser, if supported)
  • Convert to WebP (wasm-vips, uses libwebp)
  • Convert to AVIF (wasm-vips, uses libavif)
.png
  • Do nothing
  • Compress (browser)
  • Compress (wasm-vips, uses libspng)
  • Convert to WebP (browser)
  • Convert to WebP (wasm-vips, uses libwebp)
  • Convert to AVIF (wasm-vips, libavif)
.webp
  • Do nothing
  • Compress (browser, if supported)
  • Compress (wasm-vips, uses libwebp)
.avif
  • Do nothing
  • Compress (wasm-vips, uses libavif)
.gif
  • Do nothing
  • Convert to MP4 (ffmpeg)
.heic
  • Do nothing (essentially disallow upload)
  • Convert to JPEG (libheif-js, then browser)
  • Convert to JPEG (libheif-js, then wasm-vips, uses MozJPEG)
  • Convert to WebP (libheif-js, then browser, if supported)
  • Convert to WebP (libheif-js, then wasm-vips, uses libwebp)
  • Convert to AVIF (libheif-js, then wasm-vips, uses libavif)

Note: ffmpeg also has libwebp, but seems pointless as there is already wasm-vips. So maybe remove that again?

Note: both jsquash and wasm-vips use mozjpeg, so can remove the former

Note: vips also supports jpeg xl

swissspidy commented 7 months ago

Going with this for now:

Media preferences modal in the block editor Media recording settings
erikyo commented 7 months ago
swissspidy commented 7 months ago

I thought about that, but need to think more about how to not make that confusing.

swissspidy commented 7 months ago

I suppose we could start with a quality setting per format. Not sure if other stuff is even supported.

That would match existing behavior in core, where the default quality setting for jpeg and webp was different (82 vs 86)

erikyo commented 7 months ago

I thought about that, but need to think more about how to not make that confusing.

Seems fair to me though maybe an advanced tab for this purpose of fine tuning might appeal cool

I suppose we could start with a quality setting per format. Not sure if other stuff is even supported.

I remember correctly WordPress doesn't support progressive jpeg (even if I think it's a shame https://www.smashingmagazine.com/2018/02/progressive-image-loading-user-perceived-performance/).

If you could make a table "format in" "format out" (select) and quality (range slider) would be more than excellent

enabled extension (in) desidered out quality
X jpeg/jpg mozjpeg -----*- 82%
x png webp -----*- 86%
webp
avif ---*--- 50%

(....)

swissspidy commented 7 months ago

I remember correctly WordPress doesn't support progressive jpeg

vips / mozjpeg does, so that's nice :)

If you could make a table "format in" "format out" (select) and quality (range slider) would be more than excellent

Yeah that's what I was getting at with the table in the issue the description, and it would definitely provide most flexibility, but also make things more complex. But as you say, maybe an advanced tab for this would be best.

swissspidy commented 7 months ago

Reopening for looking into advanced configuration