Skip to content

Skip image processing with eleventy-img - raw image? #133

@alvarotrigo

Description

@alvarotrigo

I have some images on the blog posts that are on the .md file on the layout front matter as images to use for sharing in social media and as a thumbnail.

Those images still need to be moved to the _site folder and I would like to move them only once and only if they change.
That's why I considered using eleventy-img for them instead of just using fs.copyFile.

I want to make use of the eleventy-img cache for this but i don't want eleventy-img to process them at all.
They are in png and for some reason eleventy-img ends up creating a bigger file.

Source file 5.9Kb and output file is 7.7Kb.
Both png.

Is there a way to tell eleventy-img we want to skip any kind of image processing?

I tried using sharOptions to pass the raw option, but it doesn't seem to do the trick:

                await Image(src, {
			formats: ["png"],
			outputDir: outputDir,
			useCache: false,
			sharOptions: {
				raw: true
			},

			// Define custom filenames for generated images
			filenameFormat: function (id, src, width, format, options) {
				const name = path.basename(src, format);

				return `${name}${format}`;
			}
		})

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request
    No fields configured for Vote Queue.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions