diff --git a/src/lib/optimizer.ts b/src/lib/optimizer.ts index b9a9f59..d5df5aa 100644 --- a/src/lib/optimizer.ts +++ b/src/lib/optimizer.ts @@ -27,15 +27,15 @@ export function optimizeImage({ } if (contentType === AVIF) { - const avifQuality = Math.max(quality - 25, 45) + const avifQuality = Math.max(quality - 25, 40) transformer .avif({ - effort: 3, + effort: 4, quality: avifQuality, chromaSubsampling: '4:2:0', // same as webp bitdepth: 8, }) - .sharpen() + .sharpen({ sigma: 0.5, m1: 0.5, m2: 1.5 }) } else if (contentType === WEBP) { transformer.webp({ quality }) } else if (contentType === PNG) { diff --git a/src/server/routes/image.ts b/src/server/routes/image.ts index dcdaaa7..aad023a 100644 --- a/src/server/routes/image.ts +++ b/src/server/routes/image.ts @@ -4,12 +4,7 @@ import fs from 'fs' import { NumberFromString } from 'io-ts-types' import { PassThrough } from 'node:stream' -import { - AVIF, - returnOriginalFormats, - supportedFormats, - supportedTargetFormats, -} from '@/consts' +import { returnOriginalFormats, supportedFormats, supportedTargetFormats } from '@/consts' import { getWithCache } from '@/lib/cache' import { config, shouldUseOssCompressionForAvif } from '@/lib/config' import { D, E, O } from '@/lib/fp'