Skip to content

Client-side media: very large (especially interlaced) images fail processing instead of falling back to the server #78950

Closed

Description

@adamsilverstein

Description

When client-side media processing is enabled, uploading a very large image can fail outright instead of falling back to the server. wasm-vips is hard-capped at 1 GiB of WASM memory (kleisauke/wasm-vips#106), so a high-megapixel image — which needs roughly width × height × 4 bytes for its decoded buffer plus working memory for the encode step — can exhaust the cap and throw.

This is especially common for interlaced/progressive JPEGs (and Adam7-interlaced PNGs), which cannot be decoded with shrink-on-load and so must be buffered in full.

Reported by @ozgursar in #76756 (comment), with the root cause confirmed by @kleisauke in #76756 (comment).

Steps to Reproduce

  1. Enable client-side media processing (Chromium 137+).
  2. Upload a very large interlaced/progressive JPEG — for example flower.jpg (20000 × 11857 px, ~8.1 MB) from the report.
  3. Processing fails.

Expected

The image uploads successfully. Images that are too large to process safely in the browser should fall back to server-side processing (which has no comparable per-image memory ceiling), the same way they already upload fine through the normal media library.

Actual

The upload fails with an out-of-memory error, e.g.:

Caused by: Error: unable to call VipsForeignSaveJpegTarget

The same image uploads without issue through the standard (server-side) media library path.

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Client Side MediaMedia processing in the browser with WASM[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions