Skip to content

Image v7.0.0: The Memory Efficiency Release

Latest

Choose a tag to compare

@zachleat zachleat released this 29 Jul 16:18
Immutable release. Only release title and notes can be modified.
f69b24b

TL;DR: ESM-only, Node 22+ minimum, and huge memory and performance wins over v6.

Thank you to @sentience, @valadaptive, @kirthi-b, @jens-struct, and @jornmineur for their contributions to this release!

Issue Milestone: https://github.com/11ty/eleventy-img/milestone/25?closed=1
Full Changelog: v6.0.4...v7.0.0

Breaking changes

  • Node 22 or newer is required. This matches Core v4. #351
  • The package is now ESM. This is unlikely to require any changes as the Node minimum now supports require(esm). #300
    • ESM: import Image from "@11ty/eleventy-img"
    • CommonJS friendly: const Image = await import("@11ty/eleventy-img")
  • Upgrades sharp from v0.33 to v0.35 #352, #289
    • You can review the upstream v0.34 and v0.35 changelogs.

And a few breaking changes that are unlikely to affect most projects:

  • If you use the Transform method and set both width and eleventy:widths on the same element, note that eleventy:widths now takes priority. #314
  • Image.statsSync and Image.statsByDimensionsSync have been removed after being deprecated in 2024. Use the statsOnly feature instead, like so: await Image(src, { statsOnly: true, /* …options */ }). Helpful error messaging is provided if your project uses these (so don’t worry about it until you run into it, they weren’t commonly used). #211 #295
  • Removes the <eleventy-image> WebC component (use the transform method instead) #305

New Features

  • New passthrough format (usage: formats: ["passthrough"]) copies and uses the source file directly, while still adding width and height attributes to the generated output. Useful when you've already optimized your source images and want to skip the optimization pipeline — about 20× faster in local benchmarks. Example on #212. Also #133, #183, #309
  • New eleventy:sizes attribute allows overriding any sizes attribute in markup #306
  • New manualCacheKey option to improve the cropping API #271 #274 by @jens-struct

Bug Fixes

Line chart showing memory issues in v6, better performance in v5, but far improved performance in v7
  • Huge memory usage improvements from @sentience in #313 and @jornmineur in #302 #319 (v6 had issues, but we’ve eclipsed v5 performance with this release 🏆)
  • Removes the w descriptor when only one size is used in srcset, fixing valid HTML output when only one width is used and no sizes is present (#298).
  • Fixes eleventy:ignore appearing in output on <img> tags inside <picture> elements — by @valadaptive in #303.
  • Decodes HTML entities on <img src> when read back from HTML, by @kirthi-b #349 #307

Internals