I'm functionally attempting to replicate the behavior of an imagemagick -resize 1000x1000 command, where the output is just going to be a proportionately scaled image with the largest dimension being no more than 1000px. Sharp seems to be able to do this thanks to withoutEnlargement: true and fit: inside but I'm running into issues trying to pass sharp options.
I've tried a ton of permutations of the below (specifying widths instead of auto, using sharpResizeOptions, so on and so forth), but nothing seems to take. The sharp width and height options just seem to be fully ignored no matter what
eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
// output image formats
formats: ["webp"],
// output image widths
widths: ["auto"],
outputDir: "public_html/data/",
urlPath: "/data/",
sharpOptions: {
resize: {
width: 1000,
height: 1000,
fit: "inside",
withoutEnlargement: true
}
},
});
At this point I'm not sure if I'm doing something wrong or if this is just unsupported behavior, and if it is the latter, would supporting it be a potential enhancement? I know most folks are doing something way more complicated than my use case, which is just a simple 1 size transform, but having the option to easily override the plugin's "widths" (assuming that is where the issue rests) and specify via sharpOptions instead would be handy here.
I'm functionally attempting to replicate the behavior of an imagemagick -resize 1000x1000 command, where the output is just going to be a proportionately scaled image with the largest dimension being no more than 1000px. Sharp seems to be able to do this thanks to
withoutEnlargement: trueandfit: insidebut I'm running into issues trying to pass sharp options.I've tried a ton of permutations of the below (specifying
widthsinstead of auto, using sharpResizeOptions, so on and so forth), but nothing seems to take. The sharp width and height options just seem to be fully ignored no matter whatAt this point I'm not sure if I'm doing something wrong or if this is just unsupported behavior, and if it is the latter, would supporting it be a potential enhancement? I know most folks are doing something way more complicated than my use case, which is just a simple 1 size transform, but having the option to easily override the plugin's "widths" (assuming that is where the issue rests) and specify via sharpOptions instead would be handy here.