opt compress rate

This commit is contained in:
fly_mc 2024-10-13 12:23:41 +08:00
parent bac5b38d1f
commit f0f5376d18

View file

@ -8,15 +8,15 @@ import { isWebpSupported } from './isWebpSupported.js';
import type { BrowserImageResizerConfigWithConvertedOutput } from '@misskey-dev/browser-image-resizer';
const compressTypeMap = {
'image/jpeg': { quality: 0.90, mimeType: 'image/webp' },
'image/png': { quality: 1, mimeType: 'image/webp' },
'image/webp': { quality: 0.90, mimeType: 'image/webp' },
'image/jpeg': { quality: 0.85, mimeType: 'image/webp' },
'image/png': { quality: 0.90, mimeType: 'image/webp' },
'image/webp': { quality: 0.85, mimeType: 'image/webp' },
'image/svg+xml': { quality: 1, mimeType: 'image/webp' },
} as const;
const compressTypeMapFallback = {
'image/jpeg': { quality: 0.85, mimeType: 'image/jpeg' },
'image/png': { quality: 1, mimeType: 'image/png' },
'image/png': { quality: 0.90, mimeType: 'image/png' },
'image/webp': { quality: 0.85, mimeType: 'image/jpeg' },
'image/svg+xml': { quality: 1, mimeType: 'image/png' },
} as const;