risu729 / astro-better-image-service

Astro integration for image compression and conversion, superseding Astro's default image service.
https://npmjs.com/astro-better-image-service
Other
10 stars 0 forks source link

Compressing images results in larger size #370

Open noone-silent opened 1 month ago

noone-silent commented 1 month ago

Some image processing can result in larger files:

grafik

Same image with compress:

grafik

risu729 commented 1 month ago

Thanks for reporting!

I'm actually not sure about its cause since it should be the issue with sharp. https://github.com/lovell/sharp/issues/3589 might be related, so could you try setting the config below? It overrides the default chromaSubsampling value used by astro-better-image-service and uses the sharp's default settings.

import betterImageService from "astro-better-image-service";
import { defineConfig } from "astro/config";

export default defineConfig({
    integrations: [
        betterImageService({
            sharp: {
                avif: {
                    chromaSubsampling: undefined
                },
            },
        }),
    ],
});