unplugin / unplugin-imagemin

📦 Compression Image compression plugin based on squoosh and sharp
194 stars 18 forks source link

support gif image compress #115

Open Alkaidcc opened 7 months ago

Alkaidcc commented 7 months ago

What problem does this feature solve?

any plan for supporting gif image compress?

What does the proposed API look like?

imagemin({
    mode: 'sharp',
    compress: {
      gif: {}
    }
  }),
ErKeLost commented 7 months ago

Neither squoosh nor sharp supports gif compression, so you may need to consider the cost of supporting this format. Do you have any good suggestions?

Alkaidcc commented 7 months ago

Dose sharp not support gif compression? https://sharp.pixelplumbing.com/api-output#gif Can we use below?

await sharp('in.gif', { animated: true })
  .gif({ interFrameMaxError: 8 })
  .toFile('optim.gif');

Optimal The features of mozjpeg and pngquant can be used to optimise the file size of JPEG and PNG images respectively, without having to invoke separate imagemin processes. Huffman tables are optimised when generating JPEG output images without having to use separate command line tools like jpegoptim and jpegtran . PNG filtering is disabled by default, which for diagrams and line art often produces the same result as pngcrush . The file size of animated GIF output is optimised without having to use separate command line tools such as gifsicle .

ErKeLost commented 7 months ago

Oh, I'm so sorry I missed this. I'll add gif compress