Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How big is an image in eleventy image?


Asked by Arabella Simon on Dec 05, 2021 FAQ



By default, Eleventy Image creates a webp and jpeg version of the image you feed it, with the same dimensions. It looks like we fed it a very large image, 7857×7462 and a ~3MB webp plus a ~6MB jpeg. If you want to create different formats, you can change this behavior using the formats option.
Consequently,
You might image any number of things that Eleventy Image could be used for: Favicons, Open Graph images, raster images embedded inside of SVG using <image/>. In addition to local file names and remote URL strings, the first argument to Image () could be a Buffer too—maybe even from Puppeteer’s page.screenshot ().
Furthermore, It’s easy to use and it does not require Eleventy. You can use it in any Node.js script. First, npm install @11ty/eleventy-img into your project. If you don’t have a project, run npm init -y in a new, empty directory. Then head over to Unsplash and find yourself a nice image.
Next,
Works great to add width and height to your images! Does not require or rely on file extensions (like .png or .jpg) in URLs or local files, which may be missing or inaccurate. This is a plugin for the Eleventy static site generator.
In this manner,
New in Image 0.7.3 You can use the whitespaceMode option to strip the whitespace from the output of the <picture> element (a must-have for use in markdown files). You’re only allowed one module.exports in your configuration file!