( image: SharpInstance, format: string, )
| 695 | } |
| 696 | |
| 697 | function applyFormatOptimizations( |
| 698 | image: SharpInstance, |
| 699 | format: string, |
| 700 | ): SharpInstance { |
| 701 | switch (format) { |
| 702 | case 'png': |
| 703 | return image.png({ |
| 704 | compressionLevel: 9, |
| 705 | palette: true, |
| 706 | }) |
| 707 | case 'jpeg': |
| 708 | case 'jpg': |
| 709 | return image.jpeg({ quality: 80 }) |
| 710 | case 'webp': |
| 711 | return image.webp({ quality: 80 }) |
| 712 | default: |
| 713 | return image |
| 714 | } |
| 715 | } |
| 716 | |
| 717 | async function tryPalettePNG( |
| 718 | context: ImageCompressionContext, |
no outgoing calls
no test coverage detected