( image: SharpInstance, format: string, )
| 680 | } |
| 681 | |
| 682 | function applyFormatOptimizations( |
| 683 | image: SharpInstance, |
| 684 | format: string, |
| 685 | ): SharpInstance { |
| 686 | switch (format) { |
| 687 | case 'png': |
| 688 | return image.png({ |
| 689 | compressionLevel: 9, |
| 690 | palette: true, |
| 691 | }) |
| 692 | case 'jpeg': |
| 693 | case 'jpg': |
| 694 | return image.jpeg({ quality: 80 }) |
| 695 | case 'webp': |
| 696 | return image.webp({ quality: 80 }) |
| 697 | default: |
| 698 | return image |
| 699 | } |
| 700 | } |
| 701 | |
| 702 | async function tryPalettePNG( |
| 703 | context: ImageCompressionContext, |
no outgoing calls
no test coverage detected